Store Hugs Developers

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(?int $page = null): array

One numbered page of the shopper's orders in this shop, newest first, 20 per page.

Parameters

Parameter Type
$page ?int The page, from 1. The first if null.

Query fields

ParameterTypeDescription
pageintegerAt least 1.

Returns

An array with data (a list of Order), links and meta:

FieldTypeDescription
linksobject
links.firststring (uri)
links.laststring (uri)
links.prevstring (uri) or null
links.nextstring (uri) or null
metaobject
meta.currentPageinteger
meta.frominteger or null
meta.lastPageinteger
meta.linksarray of object
meta.links[].urlstring (uri) or null
meta.links[].labelstring
meta.links[].pageinteger or null
meta.links[].activeboolean
meta.pathstring (uri)
meta.perPageinteger
meta.tointeger or null
meta.totalinteger
dataarray of Order
data[].idinteger
data[].orderNumberstring
data[].statusstringOne of unconfirmed, pending, processing, ready_to_ship, shipped, completed, cancelled.
data[].paymentStatusstring or null
data[].paymentMethodstring or null
data[].sourcestringcheckout, whatsapp, quotation or enquiry.
data[].placedAtstring (date-time) or null
data[].paidAtstring (date-time) or null
data[].customerobject
data[].customer.idinteger or null
data[].customer.namestring or null
data[].customer.emailstring or null
data[].customer.phonestring or null
data[].shippingAddressobject
data[].shippingAddress.line1string or null
data[].shippingAddress.line2string or null
data[].shippingAddress.neighbourhoodstring or null
data[].shippingAddress.citystring or null
data[].shippingAddress.statestring or null
data[].shippingAddress.postalCodestring or null
data[].shippingAddress.countryCodestring or null
data[].billingAddressobject or nullNull when billing is the shipping address.
data[].billingAddress.namestring or null
data[].billingAddress.phonestring or null
data[].billingAddress.line1string or null
data[].billingAddress.line2string or null
data[].billingAddress.citystring or null
data[].billingAddress.statestring or null
data[].billingAddress.postalCodestring or null
data[].billingAddress.countryCodestring or null
data[].shippingMethodstring or null
data[].notesstring or null
data[].itemsarray of object
data[].items[].productIdinteger or null
data[].items[].titlestring or null
data[].items[].skustring or null
data[].items[].quantityinteger
data[].items[].unitPriceMoneyFields: amount, currency, formatted.
data[].items[].totalMoneyFields: amount, currency, formatted.
data[].subtotalMoneyFields: amount, currency, formatted.
data[].discountMoneyFields: amount, currency, formatted.
data[].couponCodestring or null
data[].shippingFeeMoneyFields: amount, currency, formatted.
data[].taxMoneyFields: amount, currency, formatted.
data[].totalMoneyFields: amount, currency, formatted.
data[].refundedMoneyFields: amount, currency, formatted.
data[].shipmentobject or null
data[].shipment.carrierstring or null
data[].shipment.trackingNumberstring or null
data[].shipment.statusstring or nullThe shipment status's label, in the response language.
data[].receiptUrlstring (uri)
data[].updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404Not found, or the shop's plan has no Integration API.
429Rate limited.

Example

$page = $shopper->customer->orders->list();

foreach ($page['data'] as $order) {
    echo $order['id'], PHP_EOL;
}

Get an order

$shopper->customer->orders->get(int $id): array

One of the shopper's orders, by its id.

Parameters

Parameter Type
$id int The order's id.

Returns

An Order array:

FieldTypeDescription
idinteger
orderNumberstring
statusstringOne of unconfirmed, pending, processing, ready_to_ship, shipped, completed, cancelled.
paymentStatusstring or null
paymentMethodstring or null
sourcestringcheckout, whatsapp, quotation or enquiry.
placedAtstring (date-time) or null
paidAtstring (date-time) or null
customerobject
customer.idinteger or null
customer.namestring or null
customer.emailstring or null
customer.phonestring or null
shippingAddressobject
shippingAddress.line1string or null
shippingAddress.line2string or null
shippingAddress.neighbourhoodstring or null
shippingAddress.citystring or null
shippingAddress.statestring or null
shippingAddress.postalCodestring or null
shippingAddress.countryCodestring or null
billingAddressobject or nullNull when billing is the shipping address.
billingAddress.namestring or null
billingAddress.phonestring or null
billingAddress.line1string or null
billingAddress.line2string or null
billingAddress.citystring or null
billingAddress.statestring or null
billingAddress.postalCodestring or null
billingAddress.countryCodestring or null
shippingMethodstring or null
notesstring or null
itemsarray of object
items[].productIdinteger or null
items[].titlestring or null
items[].skustring or null
items[].quantityinteger
items[].unitPriceMoneyFields: amount, currency, formatted.
items[].totalMoneyFields: amount, currency, formatted.
subtotalMoneyFields: amount, currency, formatted.
discountMoneyFields: amount, currency, formatted.
couponCodestring or null
shippingFeeMoneyFields: amount, currency, formatted.
taxMoneyFields: amount, currency, formatted.
totalMoneyFields: amount, currency, formatted.
refundedMoneyFields: amount, currency, formatted.
shipmentobject or null
shipment.carrierstring or null
shipment.trackingNumberstring or null
shipment.statusstring or nullThe shipment status's label, in the response language.
receiptUrlstring (uri)
updatedAtstring (date-time) or null

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404order_not_found, or the shop's plan has no Integration API.
429Rate limited.

Example

$order = $shopper->customer->orders->get(1042);