Read an order
const url = 'https://api.ebitex.io/commerce/delivery/v1/orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.ebitex.io/commerce/delivery/v1/orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>'Reads an order placed through the store the key is bound to: its status, its totals, what was bought, how much of each line has shipped, and each shipment with its carrier, tracking number and link, and status. This is how your storefront learns that a payment went through (the status leaves awaiting_payment) and where the parcel is.
The status is one of awaiting_payment, payment_failed, expired, processing, partially_fulfilled, fulfilled, cancelled, partially_refunded and refunded; it is worked out from what has been paid, shipped, cancelled and refunded and is never set by hand. A shipment’s status is shipped, in_transit, delivered or exception.
The answer carries no buyer contact details and no delivery address.
A browser-safe key must send either the cart token of the cart that became the order, in X-Cart-Token (it reads that one order for 30 days from the order’s creation, then nothing), or the visitor token of the shopper who placed it, in X-Visitor-Token, and reads only those orders: any other order, one whose cart token has expired, or one that does not exist, is 404 order_not_found. A server key (one with no origin or address restriction) may read any order of its store, with or without a token, which is how your own server confirms a payment. Nothing is cached, and an order may be read a few times a second.
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
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Responses
Section titled “ Responses ”OK
cart_credential_required: send the cart’s token in X-Cart-Token (or the shopper’s visitor token in X-Visitor-Token); visitor_token_required when only a visitor token was sent and it is not valid.
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.
order_not_found: no such order for this shopper or this store.
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.