List the signed-in customer's entitlements
const url = 'https://api.ebitex.io/commerce/delivery/v1/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/entitlements \ --header 'Authorization: Bearer <token>'Lists what the customer this device has signed in as is entitled to in this store, newest first, so your storefront can show what is unlocked. 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. Reading it links any paid guest order made with an address the sign-in proved, which turns that order’s pending entitlements active.
Pass limit (1 to 50, default 20). The answer is { "items": [ entitlement ] } in the shape of getCommerceOrderEntitlements. Nothing is cached. A cart token cannot list entitlements: this route needs the visitor token.
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 ”Query Parameters
Section titled “Query Parameters”Responses
Section titled “ Responses ”OK
visitor_token_required (send the shopper’s visitor token) or sign_in_required (this device has not signed in).
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 there are no signed-in customers.
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.