Orders, Returns & Reviews
Orders
Access via client.orders.
// Customer order history (requires auth token)
const { orders, nextCursor } = await client.orders.list({ limit: 20 })
// Public order lookup by order number (no auth required)
const order = await client.orders.getByReference('ORD-12345')
Invoices
An order carries the invoices the merchant's accounting system has issued for it. There can be several: a partially delivered order is normally invoiced once per delivery. Only finalised invoices are exposed, so a draft still being edited in the ERP never appears.
const order = await client.orders.get('ORD-12345')
for (const invoice of order.invoices ?? []) {
console.log(invoice.documentNumber, invoice.status, invoice.dueDate)
if (invoice.hasDocument) {
const pdf = await client.orders.getInvoicePdf(order.orderNumber, invoice.documentNumber)
// → Blob, ready for a download link or an object URL
}
}
status is bookkept (issued and final), paid (settled) or credited (reversed by a credit
note). getInvoicePdf streams the accounting system's own PDF through an authenticated
endpoint, so the customer must own the order and the link cannot be shared onwards.
Not to be confused with getConfirmationPdf, which returns an order confirmation. That is an
underlag we render ourselves; the invoice is the legal document and the ERP owns it.
Returns
Access via client.returns.
Self-service return widget flow:
// 1. Validate which items are returnable
const { items } = await client.returns.validate(orderReference)
// 2. Create the return
const returnOrder = await client.returns.create({
orderReference,
items: [
{ lineItemId: 'item-id', quantity: 1, reason: 'wrong_size' }
],
})
// 3. List customer's existing returns
const { returns } = await client.returns.list()
Reviews
Access via client.reviews.
// Product reviews
const { reviews, statistics } = await client.reviews.listForProduct(sku, {
limit: 10,
sort: 'newest',
})
// Site-wide reviews
const { reviews } = await client.reviews.list({ limit: 20 })
Campaigns
Access via client.campaigns.
const campaign = await client.campaigns.getByCode('SUMMER-2026')
// → StorefrontCampaign { code, name, discountType, products, ... }
Company (B2B)
Access via client.company.
// Get the customer's company
const company = await client.company.get()
// Invite a team member
await client.company.inviteMember({ email: 'colleague@company.com' })