Orders & Fulfillment
Manage orders and orchestrate complex fulfillment workflows.
Admin Only: These methods require your Secret API Key (`sk_live_...`). Never use these in front-end client code.
GET
List Orders
Retrieve orders with filtering options.
List pending orders
const orders = await swat.orders.list({
status: 'pending',
limit: 20
});GET
Get Order Details
Get single order
const order = await swat.orders.get('ord_123abc');
console.log(order.items, order.shipping_address);PATCH
Update Order
Update status
await swat.orders.update('ord_123abc', {
status: 'shipped',
fulfillment_status: 'fulfilled',
metafields: [
{ key: 'tracking_number', value: '1Z999...' }
]
});POST
Orchestrate Fulfillment
Move a specific order item to the next step in its fulfillment pipeline. This triggers webhooks and updates the audit log.
Transition Item Step
// Example: Completing a 'Quality Check' step
const updatedItem = await swat.orders.transitionItem(
'ord_123abc', // Order ID
'item_789', // Item ID
{
stepId: 'step_qa_passed',
metadata: {
inspector_name: 'John Doe',
qa_score: 98
}
}
);
console.log('New Step:', updatedItem.current_step_id);