Orders

ProDepends: paymentsDepends: ecommerceDepends: backend

Record what was bought through Stripe Checkout.

Syntax

$ vela enable orders

Adds orders on top of payments with Stripe and the cart, on a project with a backend: what a buyer paid for, written by Stripe’s webhook so the app can act on it. Creates two collections:

orders
order_lines

An order is one Checkout Session, keyed by the session id, so a redelivered or replayed event updates the row it already made. Its status is Stripe’s payment_status (paid, unpaid, no_payment_required); a payment that settles after Checkout (a bank debit) is recorded unpaid and updated when it clears or fails. The lines are Stripe’s own line items, as it priced them: name, unit amount, quantity, total.

What it adds

  • src/routes/webhooks/stripe/handlers/checkout/ - Handlers for checkout.session.completed and the two async_payment events, routed from dispatch.ts, so they run inside the stripe-event workflow with its retries.
  • /checkout/success now shows the order’s lines once the webhook has recorded it, and Stripe’s summary until then.

With auth on, the order records the buyer’s Stripe customer and user, signed-in buyers see their own orders at /orders and /orders/[id], and an Orders item joins the user menu. With notifications on, a paid order drops one on its buyer. Guests have Stripe’s receipt.

Testing locally

Forward Stripe’s events to your dev server and complete a checkout with a test card:

$ stripe listen --forward-to localhost:5173/webhooks/stripe

Other providers

Shopify keeps its own orders; link to the store’s customer account pages. WhatsApp orders are submissions of the hosted order form and live in the VelaStack dashboard. vela enable orders is for Stripe.