Skip to content

List the signed-in customer's orders

GET
/commerce/delivery/v1/orders
curl --request GET \
--url https://api.ebitex.io/commerce/delivery/v1/orders \
--header 'Authorization: Bearer <token>'

Lists the orders of the customer this device has signed in as, newest first, for an order history page. It needs the store to be connected to Audience, and the shopper’s visitor token in X-Visitor-Token from a device that has proved who it is by following the emailed sign-in link (the link is sent after a paid checkout where the buyer agreed to it, see signInConsent). Only the signed-in customer’s own orders are returned, in the same shape as getCommerceOrder, never another shopper’s and never a guest order by guessing an id.

Reading the history also links any paid guest order of this store made with an address the sign-in proved, and records those purchases on the customer’s timeline in Audience. An address that was typed at a checkout but never proved links nothing. A test order is listed and linked too, but it is never written to the customer’s timeline.

Pass limit (1 to 50, default 20). The answer is { "items": [ order ] }. Nothing is cached. A cart token cannot list orders: this route needs the visitor token, whatever other credentials the key’s cart routes accept.

A cart belongs to one shopper in one store and holds SKUs and quantities only: it never holds a price, because the server prices everything, so a client cannot name one. A cart is opened by its own token, sent in X-Cart-Token (the cartToken that creating the cart returned, once), or by the shopper’s visitor token, sent in X-Visitor-Token, or by both; a request with neither is 401 cart_credential_required, and one that sends only a visitor token that is missing, expired, revoked or unrecognised is 401 visitor_token_required. A cart token opens exactly one cart (and, after payment, the one order it became) and nothing else; it is a secret, never placed in a URL. A wrong token, another cart (in this store or another), and a deleted cart all answer 404 cart_not_found, as an unknown cart does. The key must carry the checkout permission (Allow carts and checkout when the key is made); a key that can only read answers 403 scope_denied. Cart responses are never cached (Cache-Control: private, no-store).

Key: commerce.orders.read

limit
integer | string format: int32
/^-?(?:0|[1-9]\d*)$/

OK

visitor_token_required (send the shopper’s visitor token) or sign_in_required (this device has not signed in: send the shopper the emailed link, or start a sign-in through Audience).

missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired, or its store binding was removed.

payment_required: the organization’s subscription needs attention.

scope_denied: the key was not allowed to run carts and checkout.

scope_denied: the key lacks commerce.delivery.read. app_not_available: Commerce is not enabled for the organization. origin_denied or ip_denied: the key was used from an origin or address outside its restrictions.

cart_not_found: there is no such cart for this shopper in this store.

audience_not_connected: the store is not connected to Audience, so its orders are guest orders and there is no history to show.

audience_unavailable (try again shortly) or audience_connection_broken (the store’s Audience connection needs to be set up again by its owner).

rate_limited: slow down; Retry-After says how long to wait.

rate_limited: the key spent its requests-per-minute budget; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.