Create Instant Order ๐
Facilitates the creation of a new order containing exactly one product with a quantity of one per request. Upon receiving the client request, the API will immediately initiate the order fulfillment process.
The API will briefly attempt to fulfill the order by checking existing inventory. If the requested product is available in stock, it reserves the product for immediate fulfillment and returns a response with status COMPLETED
. Clients can then retrieve their code using the GetCodes
API.
If the inventory lookup finds that the requested stock is unavailable, the API initiates an asynchronous fulfillment process. In this case, the API immediately returns a response with status PROCESSING
. Clients are responsible for periodically polling the order status via the provided transaction ID until the order status transitions to COMPLETED
, indicating availability for retrieval.
Note: The API does not maintain an active connection for up to 30 seconds anymore. It returns immediately after attempting the initial inventory lookup, responding with either a
COMPLETED
orPROCESSING
status.
POST /v2/orders/instant
โ
Requestโ
HTTP Headersโ
To use this endpoint, you must include the following headers for authentication and authorization:
Header | Type | Required | Description |
---|---|---|---|
x-api-key | String | Yes | API key assigned to your account for service access. |
Authorization | String | Yes | Bearer token to authenticate the API request. |
Payloadโ
Property | Type | Required | Default Value | Description |
---|---|---|---|---|
clientOrderNumber | String | No | None | The order number assigned by the client, used for tracking and reference purposes. |
๐enableClientOrderNumberDupCheck | Boolean | No | false | Enable to prevent duplicate clientOrderNumber |
sku | String | Yes | The Stock Keeping Unit identifier for the product. |
Example Requestโ
POST /v2/orders/instant HTTP/1.1
Host: api.example.com
Content-Type: application/json
x-api-key: <API_KEY>
Authorization: Bearer <BEARER_ACCESS_TOKEN>
{
"clientOrderNumber": "1234",
"sku": "8PX-UF-Y5U"
}
Responsesโ
HTTP Status Codesโ
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
500 | Internal Server Error |
Schemaโ
Property | Type | Nullable | Description |
---|---|---|---|
requestId | String | No | Unique identifier assigned to each request for tracking purposes. |
data | OrderResponse | No | Order response. |
OrderResponseโ
Property | Type | Nullable | Description |
---|---|---|---|
transactionId | String | No | The transaction identifier. |
clientOrderNumber | String | No | The client's order number. |
grandTotal | MoneyResponse | No | The grand total amount and currency. |
createdAt | String | No | Timestamp of when the order was created. |
status | OrderStatus | No | The status of the order. |
products | ProductResponse[] | No | List of products in the order. |
ProductResponseโ
Property | Type | Nullable | Description |
---|---|---|---|
sku | String | No | The SKU of the product. |
quantity | Integer | No | The quantity of the product. |
unitPrice | MoneyResponse | No | The unit price of the product. |
totalPrice | MoneyResponse | No | The total price of the product. |
status | OrderStatus | No | The status of the product. |
MoneyResponseโ
Property | Type | Nullable | Description |
---|---|---|---|
amount | String | No | The monetary amount. |
currency | String | No | The currency of amount. |
OrderStatusโ
Value | Type | Description |
---|---|---|
PROCESSING | String | The order is currently being processed. |
COMPLETED | String | The order has been completed successfully. |
CANCELLED | String | The order has been cancelled and will not be processed. |
Example 200 OK Responseโ
{
"requestId": "c4c7b997-79a5-4bde-9f17-47ad7eac9ed4",
"data": {
"transactionId": "1234",
"clientOrderNumber": "1234",
"grandTotal": {
"amount": "9.75",
"currency": "USD"
},
"createdAt": "2023-10-17T09:00:00Z",
"status": "COMPLETED",
"products": [
{
"sku": "8PX-UF-Y5U",
"quantity": 1,
"unitPrice": {
"amount": "9.75",
"currency": "USD"
},
"totalPrice": {
"amount": "9.75",
"currency": "USD"
},
"status": "COMPLETED"
}
]
}
}