Orders
Order management in the dashboard — listing, detail, fulfillment, and refunds.
The dashboard provides order visibility and management actions for the active organization's store.
Order list
Route: /orders
Paginated table of orders:
| Column | Description |
|---|---|
| Order # | Order ID (short format) |
| Customer | Email and name |
| Status | placed, approved, fulfilled, cancelled |
| Payment | unpaid, paid, refunded, voided |
| Fulfillment | unfulfilled, in_progress, fulfilled |
| Total | Grand total (formatted with currency) |
| Date | Order creation date |
Filters: status, payment status, date range.
Order detail
Route: /orders/[id]
Displays full order information:
Order summary
- Order ID, status, creation date
- Customer info (email, name, phone)
- Payment status and provider
- Fulfillment status
- Order totals (subtotal, tax, shipping, discount, grand total)
Line items
Each item shows product name, variant, quantity, unit price, and line total.
Addresses
Shipping and billing addresses as provided during checkout.
Actions
| Action | API endpoint | Description |
|---|---|---|
| Fulfill | POST /v1/admin/orders/{id}/fulfill | Mark as shipped with tracking info |
| Cancel | POST /v1/admin/orders/{id}/cancel | Cancel the order with optional reason |
| Refund | POST /v1/admin/orders/{id}/refund | Full refund via payment provider |
Actions are conditionally shown based on current status:
| Action | Visible when |
|---|---|
| Fulfill | status is placed or approved AND paymentStatus is paid |
| Cancel | status is placed or approved |
| Refund | status is approved or fulfilled AND paymentStatus is paid |
Server actions in app/(dashboard)/orders/actions.ts:
'use server'
export async function fulfillOrderAction(id: string, input: FulfillOrderInput) { ... }
export async function cancelOrderAction(id: string, note?: string) { ... }
export async function refundOrderAction(id: string, note?: string) { ... }Order timeline
The detail page includes a timeline card showing the full history of status changes, with timestamps and notes. Data is fetched from GET /v1/admin/orders/{id}/history.
Customer card
Displays the customer's name, email (contactEmail captured at checkout), and phone number from the shipping address.
Order status model
Orders use a three-dimensional status model inspired by Commerce Layer, separating order lifecycle, payment, and fulfillment into independent fields.
Order status (lifecycle)
| Status | Meaning | Triggered by |
|---|---|---|
placed | Order submitted, awaiting payment | Customer completes checkout |
approved | Payment confirmed, ready to fulfill | Stripe webhook (payment.captured) |
fulfilled | All items shipped | Admin fulfills order |
cancelled | Order voided | Payment failure or admin cancellation |
Payment status
| Status | Meaning | Triggered by |
|---|---|---|
unpaid | No payment received yet | Default at placement |
authorized | Funds held, capture pending | Auth-only gateways |
paid | Payment captured successfully | Stripe webhook |
partially_refunded | Partial refund issued | Admin partial refund |
refunded | Fully refunded | Admin full refund |
voided | Authorization cancelled | Payment failure or cancellation |
free | Zero-amount order | Coupons/gift cards cover full total |
Fulfillment status
| Status | Meaning | Triggered by |
|---|---|---|
unfulfilled | No items shipped yet | Default at placement |
in_progress | Some items shipped | Partial fulfillment (future) |
fulfilled | All items shipped | Admin fulfills order |
not_required | Digital-only order | Auto-set for non-physical items |
Lifecycle timestamps
| Field | Set when |
|---|---|
placedAt | Order is created |
approvedAt | Payment is confirmed |
cancelledAt | Order is cancelled |
fulfilledAt | Order is fully shipped |
Typical flow
Customer places order
→ status: placed, paymentStatus: unpaid, fulfillmentStatus: unfulfilled
Stripe webhook confirms payment
→ status: approved, paymentStatus: paid
Admin ships the order
→ status: fulfilled, fulfillmentStatus: fulfilled
--- OR ---
Payment fails
→ status: cancelled, paymentStatus: voidedRefund flow
- Merchant clicks Refund on order detail page
- Dashboard sends
POST /v1/admin/orders/{id}/refundwith amount and reason - API calls payment provider's
refund()method with tenant credentials - Order status updated to
cancelled, payment status torefunded - Webhook from provider confirms refund completion
API endpoints used
| Action | Method | Endpoint |
|---|---|---|
| List orders | GET | /v1/admin/orders |
| Get order | GET | /v1/admin/orders/{id} |
| Get order history | GET | /v1/admin/orders/{id}/history |
| Fulfill order | POST | /v1/admin/orders/{id}/fulfill |
| Cancel order | POST | /v1/admin/orders/{id}/cancel |
| Refund order | POST | /v1/admin/orders/{id}/refund |