Skip to main content

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

Time Limit

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

ParameterTypeRequiredDescription
orderIdstring / integerYesThe unique identifier of the order to accept

Request Body

No request body is required for this endpoint.

Example Request

POST /api/developer/v1/orders/12345/accept
Authorization: Bearer <your-token>
Accept: application/json

Response Specification

Success Response

200 OK

A 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

Best Practices
  • 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.