Skip to main content
Version: v1 (Current)

Attendee shop, cart and checkout integration

This guide describes the shop API in platform commit 7d7becc8f4317fe5949ff9f8b5ed97535c318b79 (PR #4490). Confirm the feature and API base in your deployment before integrating. Complete payment/project setup and catalog configuration, then use an approved test project to verify the full purchase lifecycle.

The shop sells retail products, activity add-ons and session tickets. Admission is purchased through registration, rather than this cart. The reviewed shop context supplies no access code, and these controller methods do not read one from the request. Code-only/hidden items therefore have no unlock flow in this shop contract; do not invent an access_code parameter or assume registration code handling carries over. Confirm a supported implementation with the platform owner if this is required. The shop API is an integration surface; configuring a catalog does not automatically place a shop App on a portal page.

Identity and request scope​

The controllers require the signed-in portal guard user to be an attendee whose project_id matches the project resolved for the request. A signed-out visitor or attendee from another project receives 401 with error: unauthenticated. Removing Sanctum from this route group does not make it an anonymous shopping API. A dashboard session, reader credential or project/page key alone is not an attendee identity for this controller.

Use the supported portal session/client integration for the intended host. Preserve the same attendee session when loading the catalog, editing the cart, starting checkout and polling its result. Confirm allowed origins, session/cookie behavior and project isolation in the actual environment; this source review does not establish cross-origin login support. Never ship dashboard credentials or a server secret in a public App. See integration surfaces (repository reference: ../../../developer-tools/getting-started/integration-surfaces.md).

The table below uses paths relative to the configured v1 API base, with {scope} meaning /projects/{teamSlug}/{projectSlug}/commerce. On a portal host with portal routes enabled, the source registers these paths under /api/v1; for example, /api/v1/projects/{teamSlug}/{projectSlug}/commerce/catalog. The reference represents this as a /v1/... path below an /api base. Its global API-host server selection does not establish portal-session support on that host: the portal middleware starts a session, while the API middleware has a different configuration. Confirm the intended portal host and session integration in your environment; do not infer it from the dashboard URL. Use numeric item IDs and the returned order UUID, rather than catalog names or guessed numeric order IDs.

Method and relative pathPurpose
GET {scope}/catalogThis attendee's eligible catalog in data
GET {scope}/catalog/{item}Item in data plus eligible sibling variants; unavailable item returns 404
GET {scope}/cartCurrent cart presentation in data
POST {scope}/cart/itemsAdd quantity: item_id required, quantity optional (default 1)
PATCH {scope}/cart/items/{item}Set absolute quantity; zero removes
DELETE {scope}/cart/items/{item}Remove that item
POST {scope}/checkoutReprice, reserve stock and start payment/free fulfillment
GET {scope}/checkout/{order}Poll the attendee's scoped order status
DELETE {scope}/checkout/{order}Attempt to leave checkout and restore eligible selections
GET {scope}/ordersUp to 100 visible orders, newest first
GET {scope}/orders/{order}One scoped non-draft order
GET {scope}/ticketsPurchased ticket/pickup credentials and QR values

These routes have a Commerce throttle and checkout has an additional throttle. Handle throttling without tight retry loops; no specific deployed rate was verified here. Draft, cancelled, expired and refund-failed orders are absent from the My Orders list, while a known scoped non-draft order can still be looked up individually. The list includes pending payment, paid, fulfilled, partially refunded, refunded and failed-fulfillment states; it is not a complete order ledger or pagination contract.

Cart behavior and request examples​

A cart is a draft shop order for this attendee/project. The service finds the latest matching draft. Reading a cart recomputes prices and availability; it does not reserve inventory. Another buyer can consume stock before checkout. Display the returned line totals, problems and can_checkout, rather than trusting a cached price or counting selected items alone.

Request bodies below are illustrative shapes, not commands to run against a live project. Replace 123 with an item returned by this attendee's catalog.

{"item_id": 123, "quantity": 1}

The POST adds to existing quantity. A retry can add the item again; this is not an idempotent replace operation. For an explicit target quantity, use the numeric item ID in PATCH {scope}/cart/items/{item}:

{"quantity": 2}

POST quantity accepts 1–100 when supplied; PATCH accepts 0–100. The service limits the cart to 50 distinct selections, with catalog limits applied separately. Repeated additions are cumulative; the request's per-call maximum does not establish a total-cart quantity cap of 100. The server validates the resulting selection when the changed item's next quantity is positive. Removal skips that validation, so removing a prerequisite may leave another line invalid; inspect the returned cart problems before enabling checkout.

Useful cart fields include order_uuid, currency, lines, integer subtotal_amount, item_count, problems and can_checkout. Each displayed line includes item/quantity/unit/total amounts and an optional problem. An empty cart falls back to USD in this presentation; do not use an empty response's currency as proof of the configured project currency. Never submit browser-calculated prices as authoritative.

Start and complete checkout​

The checkout controller uses the attendee profile's contact email/name. It does not accept a purchaser-email override as a documented shop contract. Missing contact email returns 422 email_required, including for a free cart; ask the attendee to update their profile through the supported flow.

  1. Refresh the cart and resolve its problems. Before submitting, retain its order_uuid securely with the project/attendee context: checkout converts this same draft UUID, allowing status lookup if the start response is lost. Review the current terms/refund policy and intended items with the buyer.
  2. Submit checkout once. The service reprices the selection, checks the explicit project payment account for a positive total, locks the draft cart and turns that same order into a pending checkout. A second attempt on that already converted draft is refused. This does not make repeated checkout requests safe: another draft may exist, so do not blindly replay the operation.
  3. Retain data.order_uuid, data.status_url, data.order, data.requires_payment and, when present, data.hold_expires_at. A payment-required response uses HTTP 201; free checkout uses HTTP 200. HTTP status alone is not proof of completed fulfillment.
  4. If payment is required, use the returned public payment configuration with the approved payment UI. It includes client_secret, publishable_key, optional stripe_account, amount and currency. These values belong to that checkout; never log client secrets, put them in URLs or include them in public diagnostics. Preserve the returned connected-account context rather than substituting a team-default account.
  5. Poll the returned status URL with bounded intervals/backoff. Show pending progress while the backend completes the order. Payment-UI success is not permission to grant credentials or mark fulfillment locally.

Free checkout does not require a payment account in this service, skips creating a PaymentIntent and invokes fulfillment synchronously. Paid checkout depends on provider/webhook processing. A handled registration/inventory fulfillment failure can return an unsuccessful order in an HTTP200 free-checkout response; inspect data.order.status, then its status endpoint. Other exceptions can escape this controller’s explicit error mappings, so no uniform recoverable-error JSON shape is guaranteed. There is no attendee retry-fulfillment endpoint in this route group: preserve the UUID and ask the commerce owner to reconcile/recover it rather than placing another order. Neither branch is accepted solely because a cart or PaymentIntent was created. The service may persist an order/holds before a later provider/event/fulfillment error; reconcile uncertain outcomes before starting another purchase.

The reviewed shop controller/cart checkout do not read a terms-acceptance request field or enforce the project's required-terms flag. Do not treat that setting or a client-only checkbox as proof of server-enforced shop consent. Have the platform owner confirm the intended implementation and acceptance before using this flow where required consent must be recorded.

Interpret status without granting early access​

Returned order stateCurrent status-presenter meaning
pending_payment, paidpending: true, success: true; still pending, including paid-but-not-fulfilled
fulfilled, partially_refundedpending: false, success: true; then inspect the order/line details and intended entitlement
cancelled, expiredTerminal unsuccessful presentation; checkout items are no longer held according to the message
refunded, failed_fulfillmentTerminal unsuccessful presentation; generic refund message is not independent evidence of a settled refund
Other/unrecognized state, including refund_failedCurrent default is pending: true, success: true; inspect the explicit state and escalate rather than spinning indefinitely

success: true alone does not mean complete. Inspect pending, status, order lines and the actual entitlement. Stop indefinite polling and offer a sanitized support handoff for an unexpected or long-running state. The selected presenter mapping was tested in isolation; provider settlement, stored refunds and fulfillment were not exercised.

Holds, cancellation and uncertain outcomes​

Inventory is held when checkout opens the order, using the project's configured hold duration. A client countdown does not release inventory. The expiry job checks provider state, can settle a succeeded payment instead of expiring it, and can extend processing/requires-action payment holds once. Its default grace is 10 minutes, but environment configuration and job execution affect actual timing. A failed provider lookup can leave work for a later run. Verify hold/queue behavior with the platform owner; detailed operator recovery stays private.

DELETE checkout attempts to abandon an unpaid checkout. If payment won the race, the controller can return 409 already_paid; continue observing that order instead of requesting another payment. This action is not a refund endpoint.

Returning to cart restores items from cancelled/expired orders by adding them to the current draft, skipping selections that fail current validation. It is not guaranteed to restore every item, and existing draft quantities may increase. For exact restoration deltas, retain both the checkout selections and any existing draft quantities before cancellation, then compare them with the returned cart. Otherwise display the returned cart for buyer review without claiming exact restored or missing quantities. Show returned problems. The response does not provide a separate omitted-items list. A returned-to-cart marker avoids ordinary repeated restoration, but concurrent/retry behavior still needs environment acceptance; do not blindly repeat a mutation after a network timeout.

After an uncertain add/update/checkout/cancel response, read the same attendee/project cart and known order first. If checkout’s response was lost, use the draft UUID retained before submission with the documented status path; a 404 can mean it has not yet converted, so it is not permission to charge again. If no UUID was retained, My Orders can show recent candidates but its 100-row/status-filtered list is not reliable request correlation. Stop automatic purchase retries and have the commerce owner identify the order from sanitized project/attendee/time/item details. Preserve the order UUID, sanitized project/item IDs, time and operation stage. Ask the commerce owner to reconcile payment/order/fulfillment state before another charge; omit session cookies, payment secrets and QR values from public reports.

Order history and tickets​

Attendee order presentation includes reference/status/channel/currency, totals/refunds, timestamps, line quantities/refunded quantities and pickup quantities. Card display is limited here to brand/last four for a succeeded payment; this selected presenter is not a whole-API privacy audit.

The tickets endpoint returns the attendee's project-scoped purchase credentials, including qr_value, kind (pickup for retail, otherwise ticket), related order UUID and pickup timestamp. Treat QR values as credentials. Listing a credential is not proof a scanner will accept it: this query does not itself filter by refunded/cancelled order status or demonstrate access-point enforcement. Verify refund/revocation, session admission and pickup behavior separately.

Troubleshooting and release acceptance​

Response/symptomCheck / recovery
401 unauthenticatedCorrect portal attendee session and matching project; a project key alone is insufficient
404 item/orderCurrent catalog visibility/eligibility or scoped ownership; do not retry under another principal to bypass it
422 email_requiredSupported attendee contact email before checkout
422 invalid_cart / sold_outRefresh cart/catalog, show keyed validation or sold-out item IDs and let the buyer revise
409 invalid_cartConverted/stale cart or invalid transition; inspect known order and current cart
503 unavailableExplicit project account configuration and current charge readiness
502 payment_unavailableProvider start failed; inspect order/cart state before retrying
409 already_paid on cancelObserve the paid order's completion; cancellation is not a refund
Pending after paymentKnown UUID/status, webhook/fulfillment progress and owner reconciliation; no duplicate charge

Have the commerce owner coordinate an allowed attendee, signed-out visitor, different-project attendee and another attendee's order UUID in an approved environment. Verify cart add versus replace, stale price/stock, limits/prerequisites, free and paid completion, payment-required action, cancellation/payment races, expiry, terms requirements, refunds, credentials and receipt delivery. Record allowed/denied responses and durable outcomes separately. No live shop, attendee, order, payment or credential mutation was performed for this guide.