Behio Storefront SDK
Customer

Orders

List, view, track, and cancel orders

List Orders

Requires customer authentication:

const orders = await client.orders.list({ page: 1, limit: 10 });
// { items: OrderListItem[], total, page, totalPages }

Order Detail

const order = await client.orders.get('ORD-2026-0042');

Cancel Order

Only PENDING orders can be cancelled:

const order = await client.orders.cancel('ORD-2026-0042');

Public Tracking

Track an order without logging in, using the tracking token from the confirmation email. For privacy this returns a minimized view (status, items, masked email, destination city), never the full address or phone, because the token travels in URLs and emails:

const { data, error } = await client.orders.track('a1b2c3d4-tracking-token');
// data: { orderNumber, status, paymentStatus, fulfillmentStatus, currency,
//         grandTotal, emailMasked, shippingCity, shippingCountry, items, createdAt }

Verified Guest Access (email code)

To show a guest the full order detail (full address, items, totals) without an account, verify control of the order email with a one-time code. Knowing the order number alone is never enough. The request step always returns a generic success, so order numbers can't be enumerated.

// Step 1: send a 6-digit code to the email on the order (valid 10 minutes).
await client.orders.requestAccessCode('ORD-2026-0042', '[email protected]');

// Step 2: verify the code. On success you get the full detail plus a
// short-lived token (30 min) scoped to this single order.
const { data, error } = await client.orders.verifyAccessCode(
  'ORD-2026-0042',
  '[email protected]',
  '482913',
);
// data: { accessToken, expiresIn, order: <full OrderDetail> }

// Step 3 (optional): re-fetch the detail later using the token, no code needed.
const refetch = await client.orders.getByAccessToken(data.accessToken);

The code is single-use, expires in 10 minutes, and is burned after 5 wrong attempts. Every failure returns the same generic error, so nothing about the order can be probed.

Order Statuses

StatusDescription
PENDINGAwaiting payment
CONFIRMEDPayment received
PROCESSINGBeing prepared
SHIPPEDDispatched
DELIVEREDDelivered
CANCELLEDCancelled
REFUNDEDRefunded

On this page