Accept Order
This endpoint allows vendors to acknowledge and accept an incoming order in the Presto system.
Overview
When a new order is received (typically notified via webhook), you must accept it to confirm that you can fulfill it. Accepting the order moves it to the next stage in the Presto system and notifies the customer.
Endpoint Details
Method: POST
URL: /api/developer/v1/orders/{orderId}/accept
Purpose: Confirm that you will fulfill the order
Orders usually need to be accepted within a specific timeframe (e.g., 5 minutes) after being received. Failure to accept within the timeframe may lead to automatic cancellation.
Request Specification
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
orderId | string / integer | Yes | The unique identifier of the order to accept |
Request Body
No request body is required for non-virtual orders.
For virtual orders, include the voucher details for each order item:
| Field | Type | Required | Description |
|---|---|---|---|
items | array[object] | Yes | The virtual items included in the order |
items[].order_item_id | string | Yes | The order item ID received in the order_created webhook |
items[].secret_code | string | Yes | The secret code or PIN used to redeem the virtual item |
items[].serial_number | string | Yes | The serial number assigned to the virtual item |
Example Request
POST /api/developer/v1/orders/12345/accept
Authorization: Bearer <your-token>
Accept: application/json
Content-Type: application/json
{
"items": [
{
"order_item_id": "35361",
"secret_code": "ABCD-EFGH-IJKL",
"serial_number": "SN-123456789"
}
]
}
Response Specification
Success Response
200 OKA successful response indicates the order was accepted.
{
"data": {
"id": "ORDER_123",
"service": "shop",
"status": {
"key": "pending",
// ...other status fields...
},
"total": 0,
"currency": "LYD",
"created_at": "2025-01-01T00:00:00+00:00"
// ...other fields...
}
}
Error Responses
401 Unauthorized - Authentication issues
{
"status": "error",
"message": "Unauthenticated"
}
404 Not Found - Order not found
{
"status": "error",
"message": "Order not found"
}
400 Bad Request - Order state error
{
"status": "error",
"message": "Order cannot be accepted in its current state"
}
Implementation Tips
- Call this endpoint promptly after receiving a new order notification
- Implement proper error handling for state conflicts
- If acceptance fails due to a transient error, implement a retry mechanism with backoff
Next Steps
After successfully accepting an order, prepare it for the customer and then use the Ready Order endpoint to indicate when it's prepared and ready for pickup or delivery.