Orders
List and retrieve orders placed in your shop. Simulate orders in sandbox for webhook testing.
Orders
Read-only access to orders placed in your shop, plus a sandbox-only endpoint for simulating orders to test your webhook integration.
List orders
Retrieve a paginated list of orders for your shop.
GET /dev/store/orders?status=NEW&page=1| Parameter | Type | Default | Description |
|---|---|---|---|
status | string | all | Filter by order status: NEW, PREPARING, READY, PICKED_UP, DELIVERED, CANCELLED, REFUNDED |
page | integer | 1 | Page number |
curl "https://api.elebne.ai/api/v1/dev/store/orders?status=NEW&page=1" \
-H "Authorization: Bearer sk_test_YOUR_KEY"const response = await fetch(
'https://api.elebne.ai/api/v1/dev/store/orders?status=NEW&page=1',
{
headers: { 'Authorization': 'Bearer sk_test_YOUR_KEY' },
}
);
const { items, total } = await response.json();
console.log(`${total} new orders`);
for (const order of items) {
console.log(`${order.referenceNumber}: ${order.totalAmount} centimes`);
}response = requests.get(
'https://api.elebne.ai/api/v1/dev/store/orders',
headers={'Authorization': 'Bearer sk_test_YOUR_KEY'},
params={'status': 'NEW', 'page': 1},
)
result = response.json()
print(f"{result['total']} new orders")
for order in result['items']:
print(f"{order['referenceNumber']}: {order['totalAmount']} centimes")Get an order
Retrieve a single order by its reference number or MongoDB ID.
GET /dev/store/orders/{referenceNumber}curl https://api.elebne.ai/api/v1/dev/store/orders/EL-3XXXXXXXXXXXXXX \
-H "Authorization: Bearer sk_test_YOUR_KEY"const response = await fetch(
'https://api.elebne.ai/api/v1/dev/store/orders/EL-3XXXXXXXXXXXXXX',
{
headers: { 'Authorization': 'Bearer sk_test_YOUR_KEY' },
}
);
const { data } = await response.json();
console.log(data.status); // "NEW"
console.log(data.items); // [{ name, quantity, price, ... }]
console.log(data.customerName); // "Aminata Diallo"response = requests.get(
'https://api.elebne.ai/api/v1/dev/store/orders/EL-3XXXXXXXXXXXXXX',
headers={'Authorization': 'Bearer sk_test_YOUR_KEY'},
)
data = response.json()['data']
print(data['status']) # "NEW"
print(data['customerName']) # "Aminata Diallo"Simulate an order (sandbox only)
Create a mock order and dispatch an order.new webhook event. Use this to test your order processing integration without real customers.
POST /dev/store/orders/simulateSandbox only
This endpoint only works with test keys (sk_test_*). It returns 403 SANDBOX_ONLY when called with live keys.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
items | array | Yes | Order items |
items[].productId | string | Yes | Product ID |
items[].quantity | integer | Yes | Quantity (min 1) |
items[].variantId | string | No | Variant ID |
customerPhone | string | No | Customer phone. Default: +22200000000 |
customerName | string | No | Customer name. Default: Test Customer |
curl -X POST https://api.elebne.ai/api/v1/dev/store/orders/simulate \
-H "Authorization: Bearer sk_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{ "productId": "6612f1a2b3c4d5e6f7890123", "quantity": 2 }
],
"customerPhone": "+22242345678",
"customerName": "Aminata Diallo"
}'const response = await fetch(
'https://api.elebne.ai/api/v1/dev/store/orders/simulate',
{
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
items: [
{ productId: '6612f1a2b3c4d5e6f7890123', quantity: 2 },
],
customerPhone: '+22242345678',
customerName: 'Aminata Diallo',
}),
}
);
const { data } = await response.json();
console.log(data.orderNumber); // "SIM-1712345678901"
console.log(data.status); // "NEW"
console.log(data.sandbox); // trueresponse = requests.post(
'https://api.elebne.ai/api/v1/dev/store/orders/simulate',
headers={
'Authorization': 'Bearer sk_test_YOUR_KEY',
'Content-Type': 'application/json',
},
json={
'items': [
{'productId': '6612f1a2b3c4d5e6f7890123', 'quantity': 2},
],
'customerPhone': '+22242345678',
'customerName': 'Aminata Diallo',
},
)
data = response.json()['data']
print(data['orderNumber']) # "SIM-1712345678901"
print(data['sandbox']) # TrueResponse
{
"success": true,
"data": {
"orderNumber": "SIM-1712345678901",
"shopId": "6612f...",
"shopName": "Restaurant Tata Aminata",
"status": "NEW",
"items": [
{ "productId": "6612f1a2b3c4d5e6f7890123", "quantity": 2 }
],
"customerPhone": "+22242345678",
"customerName": "Aminata Diallo",
"sandbox": true
}
}The simulated order dispatches an order.new webhook event with sandbox: true in the payload. Your webhook handler should check this field to distinguish test events from real ones.
Order status flow
NEW ──────> PREPARING ──────> READY ──────> PICKED_UP ──────> DELIVERED
│ │
├──> CANCELLED └──> REFUNDED
│ (customer or merchant) (merchant)
│
└──> REFUNDED
(merchant reject)Next steps
- Webhook Events -- handle
order.newand other order lifecycle events - Products -- manage the products referenced in orders
- Inventory -- stock is decremented automatically on real orders
Was this page helpful?