Customer orders
The signed-in shopper's orders in this shop.
Reach them through shopper.customer.orders. They need a client with the shopper's access token (see sign-in).
List orders
shopper.customer.orders.list(query?: { page?: number }): Promise<LengthAwarePage<Order>>
One numbered page of the shopper's orders in this shop, newest first, 20 per page.
Parameters
| Parameter | Type | |
|---|---|---|
query |
object |
The query fields below, by name. |
Query fields
| Parameter | Type | Description |
|---|---|---|
page | integer | At least 1. |
Returns
A LengthAwarePage<Order>:
| Field | Type | Description |
|---|---|---|
links | object | |
links.first | string (uri) | |
links.last | string (uri) | |
links.prev | string (uri) or null | |
links.next | string (uri) or null | |
meta | object | |
meta.currentPage | integer | |
meta.from | integer or null | |
meta.lastPage | integer | |
meta.links | array of object | |
meta.links[].url | string (uri) or null | |
meta.links[].label | string | |
meta.links[].page | integer or null | |
meta.links[].active | boolean | |
meta.path | string (uri) | |
meta.perPage | integer | |
meta.to | integer or null | |
meta.total | integer | |
data | array of Order | |
data[].id | integer | |
data[].orderNumber | string | |
data[].status | string | One of unconfirmed, pending, processing, ready_to_ship, shipped, completed, cancelled. |
data[].paymentStatus | string or null | |
data[].paymentMethod | string or null | |
data[].source | string | checkout, whatsapp, quotation or enquiry. |
data[].placedAt | string (date-time) or null | |
data[].paidAt | string (date-time) or null | |
data[].customer | object | |
data[].customer.id | integer or null | |
data[].customer.name | string or null | |
data[].customer.email | string or null | |
data[].customer.phone | string or null | |
data[].shippingAddress | object | |
data[].shippingAddress.line1 | string or null | |
data[].shippingAddress.line2 | string or null | |
data[].shippingAddress.neighbourhood | string or null | |
data[].shippingAddress.city | string or null | |
data[].shippingAddress.state | string or null | |
data[].shippingAddress.postalCode | string or null | |
data[].shippingAddress.countryCode | string or null | |
data[].billingAddress | object or null | Null when billing is the shipping address. |
data[].billingAddress.name | string or null | |
data[].billingAddress.phone | string or null | |
data[].billingAddress.line1 | string or null | |
data[].billingAddress.line2 | string or null | |
data[].billingAddress.city | string or null | |
data[].billingAddress.state | string or null | |
data[].billingAddress.postalCode | string or null | |
data[].billingAddress.countryCode | string or null | |
data[].shippingMethod | string or null | |
data[].notes | string or null | |
data[].items | array of object | |
data[].items[].productId | integer or null | |
data[].items[].title | string or null | |
data[].items[].sku | string or null | |
data[].items[].quantity | integer | |
data[].items[].unitPrice | Money | Fields: amount, currency, formatted. |
data[].items[].total | Money | Fields: amount, currency, formatted. |
data[].subtotal | Money | Fields: amount, currency, formatted. |
data[].discount | Money | Fields: amount, currency, formatted. |
data[].couponCode | string or null | |
data[].shippingFee | Money | Fields: amount, currency, formatted. |
data[].tax | Money | Fields: amount, currency, formatted. |
data[].total | Money | Fields: amount, currency, formatted. |
data[].refunded | Money | Fields: amount, currency, formatted. |
data[].shipment | object or null | |
data[].shipment.carrier | string or null | |
data[].shipment.trackingNumber | string or null | |
data[].shipment.status | string or null | The shipment status's label, in the response language. |
data[].receiptUrl | string (uri) | |
data[].updatedAt | string (date-time) or null |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
const { data: orders, meta } = await shopper.customer.orders.list({ page: 2 });
Get an order
shopper.customer.orders.get(id: number): Promise<Order>
One of the shopper's orders, by its id.
Parameters
| Parameter | Type | |
|---|---|---|
id |
number |
The order's id. |
Returns
An Order:
| Field | Type | Description |
|---|---|---|
id | integer | |
orderNumber | string | |
status | string | One of unconfirmed, pending, processing, ready_to_ship, shipped, completed, cancelled. |
paymentStatus | string or null | |
paymentMethod | string or null | |
source | string | checkout, whatsapp, quotation or enquiry. |
placedAt | string (date-time) or null | |
paidAt | string (date-time) or null | |
customer | object | |
customer.id | integer or null | |
customer.name | string or null | |
customer.email | string or null | |
customer.phone | string or null | |
shippingAddress | object | |
shippingAddress.line1 | string or null | |
shippingAddress.line2 | string or null | |
shippingAddress.neighbourhood | string or null | |
shippingAddress.city | string or null | |
shippingAddress.state | string or null | |
shippingAddress.postalCode | string or null | |
shippingAddress.countryCode | string or null | |
billingAddress | object or null | Null when billing is the shipping address. |
billingAddress.name | string or null | |
billingAddress.phone | string or null | |
billingAddress.line1 | string or null | |
billingAddress.line2 | string or null | |
billingAddress.city | string or null | |
billingAddress.state | string or null | |
billingAddress.postalCode | string or null | |
billingAddress.countryCode | string or null | |
shippingMethod | string or null | |
notes | string or null | |
items | array of object | |
items[].productId | integer or null | |
items[].title | string or null | |
items[].sku | string or null | |
items[].quantity | integer | |
items[].unitPrice | Money | Fields: amount, currency, formatted. |
items[].total | Money | Fields: amount, currency, formatted. |
subtotal | Money | Fields: amount, currency, formatted. |
discount | Money | Fields: amount, currency, formatted. |
couponCode | string or null | |
shippingFee | Money | Fields: amount, currency, formatted. |
tax | Money | Fields: amount, currency, formatted. |
total | Money | Fields: amount, currency, formatted. |
refunded | Money | Fields: amount, currency, formatted. |
shipment | object or null | |
shipment.carrier | string or null | |
shipment.trackingNumber | string or null | |
shipment.status | string or null | The shipment status's label, in the response language. |
receiptUrl | string (uri) | |
updatedAt | string (date-time) or null |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | order_not_found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
const order = await shopper.customer.orders.get(1042);