getAllOrdersByMarker
Lấy tất 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ả đơ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.
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ã Token Ứng dụng của bạn khi truy cập lần đầu, sau đó mở:
- Lịch sử đơn hàng — lấy và hiển thị các đơn hàng trước đó 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.
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);
Phản hồi ví dụ
{
"items": [
{
"id": 565,
"storageId": 1,
"createdDate": "2026-04-21T19:25:24.570Z",
"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": null,
"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": 564,
"storageId": 1,
"createdDate": "2026-04-21T19:23:38.644Z",
"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": null,
"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": 563,
"storageId": 1,
"createdDate": "2026-04-21T19:22:56.768Z",
"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": null,
"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": 371
}
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"
}
]
formData.marker: string
Dấu hiệu của trường biểu mẫu.
ví dụ: "name_1"
formData.type: string
Loại giá trị.
ví dụ: "string"
formData.value: string
Giá trị.
ví dụ: "Name"
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 của đơn hàng.
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
}
]
products.id: number
ID sản phẩm.
ví dụ: 2957
products.quantity: number
Số lượng sản phẩm.
ví dụ: 1
products.title: string
Tên sản phẩm.
ví dụ: "Cosmo"
products.sku: string | null
SKU sản phẩm.
ví dụ: "SKU"
products.previewImage: IPicture | null
Hình ảnh xem trước sản phẩm.
ví dụ:
{
"filename": "image.jpg",
"downloadLink": "https://example.com/image.jpg",
"size": 102400,
"previewLink": "https://example.com/image-preview.jpg"
}
previewImage.filename: string
Tên của tệp.
ví dụ: "image.jpg"
previewImage.downloadLink: string
Liên kết URL để tải hình ảnh.
ví dụ: "https://example.com/image.jpg"
previewImage.size: number
Kích thước của hình ảnh tính bằng byte.
ví dụ: 102400
previewImage.previewLink: string
Liên kết URL để xem trước hình ảnh.
ví dụ: "https://example.com/image-preview.jpg"
products.price: number
Giá sản phẩm.
ví dụ: 150
products.isGift: boolean
Liệu sản phẩm có phải là quà tặng hay không.
ví dụ: false
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.statusLocalizeInfos: ILocalizeInfo
Tên trạng thái đã được địa phương hóa.
total: number
Tổng số bản ghi đã tìm thấy.
ví dụ: 100