> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Tracking

> Recover an authoritative order-submission outcome and display a protected receipt.

After Stripe redirects back to the storefront, recover the cart session and the
original submission attempt ID from tab-scoped storage. Poll that attempt rather
than creating another order.

## Outcome states

| Status | Meaning |
| - | - |
| `PROCESSING` | Stripe or durable projection recovery is still in progress |
| `CUSTOMER_ACTION_REQUIRED` | The same Stripe attempt still requires customer action |
| `PAID` | Stripe capture and canonical order settlement are complete |
| `ACCEPTED` | A pay-at-store order was accepted under audited cash authority |
| `ACTION_REQUIRED` | The attempt needs an explicit recovery action and must not be replayed |

```ts theme={null}
async function waitForOrder(
  locationId: string,
  cartId: string,
  attemptId: string,
) {
  for (let poll = 0; poll < 40; poll += 1) {
    const result = await storefront.checkout.getOrderSubmissionOutcome(
      locationId,
      cartId,
      attemptId,
    );
    if (result.status !== "PROCESSING") return result;
    await new Promise((resolve) =>
      setTimeout(resolve, Math.min(1000 + poll * 250, 3000)),
    );
  }
  throw new Error("Order confirmation is taking longer than expected.");
}
```

Do not treat a redirect, cart lock, timeout, provider response, or paid settlement
projection as success by itself. The order-first attempt must report its
authoritative outcome. Keep the capability until terminal handling finishes,
then clear it from persisted storage.

## Receipt links

Guest receipt links place a receipt capability in the URL fragment so browsers
do not send it to servers as part of the request URL. Capture it in the browser,
immediately remove it with `history.replaceState`, store it in versioned,
tab-scoped `sessionStorage` keyed by API environment, merchant, and receipt ID,
and send it as `X-Receipt-Token`:

```ts theme={null}
const order = await storefront.receipts.get(receiptId, { receiptToken });
```

A signed-in customer can access their own order through the customer JWT instead.
Receipt identifiers alone never authorize access.

## Ratings

Submit a rating while the completed cart capability is still available in memory:

```ts theme={null}
await storefront.ratings.submit(locationId, cartId, {
  rating: 5,
  comment: "Great food and fast service.",
});
```

> [card] [Error Codes](/docs/guides/error-codes.md)
>
> Handle terminal and retryable failures.

> [card] [SDK Reference](/docs/getting-started/storefront-sdk.md)
>
> Review all checkout and receipt methods.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.