getAllOrdersByMarker
Lấy tất cả các đơn hàng từ đối tượng lưu trữ đơn hàng được tạo bởi người dùng. 🔐 Phương thức này yêu cầu ủy quyền.
Mô tả
Phương thức này truy xuất tất cả các đơn hàng từ lưu trữ đơn hàng được chỉ định theo dấu hiệu của nó, với phân trang. Nó trả về một Promise mà khi hoàn thành sẽ trả về một đối tượng IOrdersByMarkerEntity chứa các đơn hàng đã phân trang.
Orders.getAllOrdersByMarker(
marker*,
langCode,
offset,
limit
);
Sơ đồ tham số
Sơ đồ
marker(bắt buộc): string
Định danh văn bản của đối tượng lưu trữ đơn hàng
ví dụ: "order_storage_1"
langCode: string
Mã ngôn ngữ. Mặc định: "en_US"
ví dụ: "en_US"
offset: number
Tham số offset. Mặc định: 0
ví dụ: 0
limit: number
Tham số limit. Mặc định: 30
ví dụ: 30
Mặc định, bạn có thể truy xuất 10 đối tượng. Điều này là do giới hạn bản ghi trong cài đặt quyền của mô-đun.
Để phân trang hoạt động chính xác, bạn cần cấu hình Quyền mô-đun theo nhu cầu của bạn trong phần tương ứng.
Ví dụ
Ví dụ tối thiểu
const response = await Orders.getAllOrdersByMarker('my-order');
Ví dụ với thuộc tính
const response = await Orders.getAllOrdersByMarker('my-order', 'en_US', 0, 30);
Ví dụ phản hồi
{
"items": [
{
"id": 681,
"storageId": 1,
"createdDate": "2026-06-12T18:05:22.470Z",
"statusIdentifier": "inProgress",
"statusLocalizeInfos": {
"title": "In progress"
},
"formIdentifier": "orderForm",
"formData": [
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
],
"attributeSetIdentifier": "order_form",
"paymentStrategy": "once",
"totalSum": "285",
"totalSumRaw": "300",
"currency": "USD",
"paymentAccountIdentifier": "cash",
"paymentAccountLocalizeInfos": {
"title": "Cash"
},
"products": [
{
"id": 2957,
"title": "Cosmo",
"sku": null,
"previewImage": "",
"price": 150,
"quantity": 2,
"isGift": false
}
],
"paymentUrl": null,
"discountConfig": {
"orderDiscounts": [
{
"id": 2,
"identifier": "personal_discount",
"type": "PERSONAL_DISCOUNT",
"localizeInfos": {
"title": "Personal discount"
},
"startDate": "2026-04-21T18:26:19.815Z",
"endDate": "2028-03-21T19:26:24.741Z",
"discountValue": {
"value": 15,
"maxAmount": null,
"discountType": "FIXED_AMOUNT",
"applicability": "TO_ORDER"
},
"exclusions": null,
"position": 1,
"conditionLogic": "AND",
"gifts": [],
"userGroups": null,
"userExclusions": null,
"conditions": [],
"coupon": null
}
],
"productDiscounts": [],
"coupon": null,
"settings": {
"allowStacking": true,
"maxDiscountValue": 50,
"allowGiftStacking": false,
"maxBonusPaymentPercent": null,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"giftRefundPolicy": "KEEP_GIFT"
},
"additionalDiscountsMarkers": [],
"totalRaw": 300,
"totalSumWithDiscount": 285,
"excludedGiftProductIds": [],
"bonus": {
"availableBalance": 0,
"maxBonusDiscount": 0,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"bonusApplied": 0
},
"bonusApplied": 0,
"totalDue": 285
},
"isPartial": false,
"isCompleted": null
},
{
"id": 680,
"storageId": 1,
"createdDate": "2026-06-12T17:37:59.815Z",
"statusIdentifier": "inProgress",
"statusLocalizeInfos": {
"title": "In progress"
},
"formIdentifier": "orderForm",
"formData": [
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
],
"attributeSetIdentifier": "order_form",
"paymentStrategy": "once",
"totalSum": "285",
"totalSumRaw": "300",
"currency": "USD",
"paymentAccountIdentifier": "cash",
"paymentAccountLocalizeInfos": {
"title": "Cash"
},
"products": [
{
"id": 2957,
"title": "Cosmo",
"sku": null,
"previewImage": "",
"price": 150,
"quantity": 2,
"isGift": false
}
],
"paymentUrl": null,
"discountConfig": {
"orderDiscounts": [
{
"id": 2,
"identifier": "personal_discount",
"type": "PERSONAL_DISCOUNT",
"localizeInfos": {
"title": "Personal discount"
},
"startDate": "2026-04-21T18:26:19.815Z",
"endDate": "2028-03-21T19:26:24.741Z",
"discountValue": {
"value": 15,
"maxAmount": null,
"discountType": "FIXED_AMOUNT",
"applicability": "TO_ORDER"
},
"exclusions": null,
"position": 1,
"conditionLogic": "AND",
"gifts": [],
"userGroups": null,
"userExclusions": null,
"conditions": [],
"coupon": null
}
],
"productDiscounts": [],
"coupon": null,
"settings": {
"allowStacking": true,
"maxDiscountValue": 50,
"allowGiftStacking": false,
"maxBonusPaymentPercent": null,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"giftRefundPolicy": "KEEP_GIFT"
},
"additionalDiscountsMarkers": [],
"totalRaw": 300,
"totalSumWithDiscount": 285,
"excludedGiftProductIds": [],
"bonus": {
"availableBalance": 0,
"maxBonusDiscount": 0,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"bonusApplied": 0
},
"bonusApplied": 0,
"totalDue": 285
},
"isPartial": false,
"isCompleted": null
},
{
"id": 679,
"storageId": 1,
"createdDate": "2026-06-12T15:47:12.814Z",
"statusIdentifier": "inProgress",
"statusLocalizeInfos": {
"title": "In progress"
},
"formIdentifier": "orderForm",
"formData": [
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
],
"attributeSetIdentifier": "order_form",
"paymentStrategy": "once",
"totalSum": "285",
"totalSumRaw": "300",
"currency": "",
"paymentAccountIdentifier": "cash",
"paymentAccountLocalizeInfos": {
"title": "Cash"
},
"products": [
{
"id": 2957,
"title": "Cosmo",
"sku": null,
"previewImage": "",
"price": 150,
"quantity": 2,
"isGift": false
}
],
"paymentUrl": null,
"discountConfig": {
"orderDiscounts": [
{
"id": 2,
"identifier": "personal_discount",
"type": "PERSONAL_DISCOUNT",
"localizeInfos": {
"title": "Personal discount"
},
"startDate": "2026-04-21T18:26:19.815Z",
"endDate": "2028-03-21T19:26:24.741Z",
"discountValue": {
"value": 15,
"maxAmount": null,
"discountType": "FIXED_AMOUNT",
"applicability": "TO_ORDER"
},
"exclusions": null,
"position": 1,
"conditionLogic": "AND",
"gifts": [],
"userGroups": null,
"userExclusions": null,
"conditions": [],
"coupon": null
}
],
"productDiscounts": [],
"coupon": null,
"settings": {
"allowStacking": true,
"maxDiscountValue": 50,
"allowGiftStacking": false,
"maxBonusPaymentPercent": null,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"giftRefundPolicy": "KEEP_GIFT"
},
"additionalDiscountsMarkers": [],
"totalRaw": 300,
"totalSumWithDiscount": 285,
"excludedGiftProductIds": [],
"bonus": {
"availableBalance": 0,
"maxBonusDiscount": 0,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"bonusApplied": 0
},
"bonusApplied": 0,
"totalDue": 285
},
"isPartial": false,
"isCompleted": null
},
"..."
],
"total": 429
}
Sơ đồ phản hồi
Sơ đồ: IOrdersByMarkerEntity
items: IOrderByMarkerEntity[]
Mảng các đối tượng lưu trữ đơn hàng.
ví dụ:
[
{
"id": 55,
"storageId": 1,
"createdDate": "2025-03-22T21:12:42.371Z",
"statusIdentifier": "inProgress",
"formIdentifier": "orderForm",
"formData": [
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
],
"attributeSetIdentifier": "order_form",
"totalSum": "300.00",
"currency": "",
"paymentAccountIdentifier": "cash",
"paymentAccountLocalizeInfos": {
"title": "Cash"
},
"products": [
{
"id": 2957,
"title": "Cosmo",
"sku": null,
"previewImage": null,
"price": 150,
"quantity": 2
}
],
"isCompleted": false
}
]
items.id: number
Định danh của đối tượng.
ví dụ: 125
items.storageId: number
Định danh của đối tượng lưu trữ đơn hàng.
ví dụ: 1
items.createdDate: string
Ngày khi đơn hàng được tạo.
ví dụ: "2023-10-01T12:00:00Z"
items.statusIdentifier: string
Định danh văn bản của trạng thái đơn hàng.
ví dụ: "order-status-1"
items.formIdentifier: string
Định danh văn bản của biểu mẫu.
ví dụ: "bar-orders-form"
items.formData: IOrdersFormData[]
Dữ liệu được gửi bởi biểu mẫu liên kết với cửa hàng đơn hàng.
ví dụ:
[
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
]
items.attributeSetIdentifier: string | null
Định danh văn bản của bộ thuộc tính.
ví dụ: "attribute-set-1"
items.totalSum: string
Tổng số tiền đơn hàng.
ví dụ: "100.00"
items.totalSumRaw: string
Tổng số tiền đơn hàng thô với độ chính xác đầy đủ.
ví dụ: "100.00"
items.currency: string
Tiền tệ được sử dụng để thanh toán cho đơn hàng.
ví dụ: "USD"
items.paymentAccountIdentifier: string | null
Định danh văn bản cho thanh toán đơn hàng.
ví dụ: "payment-1"
items.paymentAccountLocalizeInfos: ILocalizeInfo
Tên tài khoản thanh toán với sự xem xét đến việc địa phương hóa.
ví dụ:
{
"title": "Cash"
}
items.products: IOrderProducts[]
Mảng các sản phẩm được thêm vào đơn hàng.
ví dụ:
[
{
"id": 1,
"name": "Product 1",
"quantity": 2
}
]
items.paymentUrl: string | null
Liên kết thanh toán.
ví dụ: "https://example.com/pay/123"
items.isCompleted: boolean | null
Chỉ ra rằng đơn hàng đã được hoàn thành.
ví dụ: true
items.isPartial: boolean | null
Chỉ ra rằng đơn hàng đã được thanh toán một phần; null trên các đơn hàng cũ mà không được theo dõi.
ví dụ: false
items.paymentStrategy: string
Chiến lược thanh toán của đơn hàng.
ví dụ: "once"
items.statusLocalizeInfos: ILocalizeInfo
Tên trạng thái đã được địa phương hóa.
items.discountConfig: IOrderDiscountConfig | null
Cấu hình giảm giá đã được giải quyết áp dụng cho đơn hàng (orderDiscounts, productDiscounts, coupon, settings, bonus, totals); null trên các đơn hàng cũ mà không có cấu hình giảm giá đã được giải quyết.
items.split: IOrderSplit
Cấu hình thanh toán chia (giai đoạn); có mặt trên điểm cuối đơn hàng theo ID.
total: number
Tổng số bản ghi được tìm thấy.
ví dụ: 100
Ví dụ sử dụng
Hướng dẫn từng bước trong tài liệu:
- Lịch sử đơn hàng — lấy và hiển thị các đơn hàng trước đây của người dùng theo dấu hiệu lưu trữ.
- Đăng ký đơn hàng — kiểm tra xem người dùng có đơn hàng đăng ký đang hoạt động hay không.
Thử nghiệm trực tiếp
Chạy phương thức này một cách tương tác trong JS SDK sandbox — kết nối URL Dự án và Mã thông báo Ứng dụng của bạn khi lần đầu truy cập, sau đó mở:
- Lịch sử đơn hàng — lấy và hiển thị các đơn hàng trước đây của người dùng theo dấu hiệu lưu trữ.
- Đăng ký đơn hàng — kiểm tra xem người dùng có đơn hàng đăng ký đang hoạt động hay không.