Customer Orders
Retrieve order history for a customer.
Updated
On this page
Overview
Retrieve the authenticated customer's order history and individual order details.
List Orders
import dash from "@/lib/dash"
const { orders, pagination } = await dash.auth.getOrders({
limit: 10,
offset: 0,
})
orders.forEach(order => {
console.log(order.order_number, order.status, order.total, order.created_at)
})
Get Single Order
const { order } = await dash.auth.getOrder("ord_abc123")
// order = {
// id: "ord_abc123",
// order_number: "ORD-1042",
// status: "shipped",
// subtotal: "59.98",
// shipping: "12.50",
// tax: "5.25",
// total: "77.73",
// items: [...],
// shipping_address: {...},
// tracking_number: "1Z999...",
// created_at: "2025-01-15T10:30:00Z"
// }
Order History Page
// app/account/orders/page.tsx
import dash from "@/lib/dash"
export default async function OrderHistory() {
const { orders } = await dash.auth.getOrders({ limit: 20 })
return (
<div>
<h1>Order History</h1>
{orders.length === 0 ? (
<p>No orders yet. <a href="/products">Start shopping</a></p>
) : (
orders.map(order => (
<a key={order.id} href={`/account/orders/${order.id}`}
className="block border rounded p-4 mb-3">
<div className="flex justify-between">
<span className="font-semibold">{order.order_number}</span>
<span>${order.total}</span>
</div>
<div className="flex justify-between text-sm text-gray-400">
<span>{order.status}</span>
<span>{new Date(order.created_at).toLocaleDateString()}</span>
</div>
</a>
))
)}
</div>
)
}
REST API
# List orders
GET /storefront/auth/orders?limit=10&offset=0
Authorization: Bearer {access_token}
# Get single order
GET /storefront/auth/orders/ord_abc123
Authorization: Bearer {access_token}
Next Steps
- Order Statuses — Understanding the order lifecycle
- Tracking — Shipment tracking
- Recipe: Customer Account Page — Full account page walkthrough