Read what an order entitles its buyer to
const url = 'https://api.ebitex.io/commerce/delivery/v1/orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/entitlements';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/entitlements \ --header 'Authorization: Bearer <token>'Lists the entitlements an order grants for its digital products: one for each unit bought. Each has a state (pending, active or revoked), the sku, whether the order was a test, when it was granted and when it ends (endsUtc, null for no end), and delivery, whether the store’s fulfilment provider has acted (none when the store names no provider, pending, done or failed). A guest’s entitlement is pending with pendingReason: email_not_proved until the buyer proves their email address with the emailed sign-in link; then it becomes active. A refund of the whole line revokes it, and an entitlement can end on a date the merchant set.
The answer is { "items": [ entitlement ] }, empty for an order with no digital products. It carries no provider message, no provider setting and no buyer contact details. Access is exactly that of getCommerceOrder: a browser-safe key sends the cart token of the cart that became the order (for 30 days) or the visitor token of the shopper who placed it, a server key may read any order of its store, and any other order is 404. Nothing is cached.
You can also subscribe to commerce.entitlement.granted and commerce.entitlement.revoked instead of polling, see the organization webhooks guide.
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.