Manage order creation, payment processing, and order lifecycle operations.
/api/orders
The Orders API provides comprehensive endpoints for managing orders, including creation, payment processing, status tracking, and bulk operations. Supports order filtering, pagination, and data export.
Creates new order with payment processing.
{
"customerId": "cust_123",
"items": [
{
"offerId": "offer_456",
"quantity": 1,
"price": 99.99
}
],
"paymentMethod": "credit_card",
"paymentGatewayId": "stripe_1"
}
{
"orderId": "ord_789",
"status": "pending_payment",
"totalAmount": 99.99,
"paymentUrl": "https://payment-gateway.com/checkout",
"createdAt": "2026-06-02T10:30:00Z"
}
Gets order details by ID with items.
| Parameter | Type |
|---|---|
| id | string |
{
"id": "ord_789",
"customerId": "cust_123",
"status": "completed",
"items": [
{
"id": "item_1",
"offerId": "offer_456",
"quantity": 1,
"price": 99.99,
"status": "fulfilled"
}
],
"totalAmount": 99.99,
"createdAt": "2026-06-02T10:30:00Z"
}
Gets orders with OData filtering and pagination.
| Parameter | Type | Description |
|---|---|---|
| $filter | string | OData filter expression |
| $orderby | string | Sort by columns |
| $skip | integer | Skip n records |
| $top | integer | Take n records |
{
"value": [
{
"id": "ord_789",
"customerId": "cust_123",
"status": "completed",
"items": []
}
],
"count": 100
}
Gets aggregated order metrics and statistics.
| Parameter | Type |
|---|---|
| startDate | date |
| endDate | date |
| groupBy | string |
{
"totalOrders": 1000,
"totalRevenue": 99999.99,
"averageOrderValue": 99.99,
"ordersByStatus": {
"completed": 800,
"pending": 150,
"cancelled": 50
}
}
Updates order status.
{
"status": "processing",
"reason": "Payment confirmed"
}
{
"id": "ord_789",
"status": "processing",
"updatedAt": "2026-06-02T10:35:00Z"
}
Bulk cancels multiple orders.
{
"orderIds": ["ord_789", "ord_790", "ord_791"],
"reason": "Customer request"
}
{
"cancelled": 3,
"failed": 0,
"results": [
{
"orderId": "ord_789",
"status": "cancelled"
}
]
}
Cancels or verifies specific order items.
{
"orderId": "ord_789",
"items": [
{
"itemId": "item_1",
"action": "cancel",
"reason": "Out of stock"
}
]
}
{
"orderId": "ord_789",
"items": [
{
"itemId": "item_1",
"status": "cancelled"
}
]
}
Exports orders to CSV or Excel file.
{
"format": "csv",
"filters": {
"status": "completed",
"startDate": "2026-01-01",
"endDate": "2026-06-02"
},
"columns": ["id", "customerId", "status", "totalAmount", "createdAt"]
}
File download (CSV/Excel)
Processes payment workflow for order.
{
"orderId": "ord_789",
"action": "process",
"paymentDetails": {
"method": "credit_card",
"token": "tok_visa",
"amount": 99.99
}
}
{
"orderId": "ord_789",
"paymentStatus": "completed",
"transactionId": "txn_123456"
}
| Code | HTTP Status | Description |
|---|---|---|
| ORDER_NOT_FOUND | 404 | Order does not exist |
| INVALID_STATUS | 400 | Invalid order status |
| PAYMENT_FAILED | 402 | Payment processing failed |
| INSUFFICIENT_INVENTORY | 400 | Not enough stock |