Skip to main content

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 or PROCESSING status.

POST /v2/orders/instantโ€‹

Requestโ€‹

HTTP Headersโ€‹

To use this endpoint, you must include the following headers for authentication and authorization:

HeaderTypeRequiredDescription
x-api-keyStringYesAPI key assigned to your account for service access.
AuthorizationStringYesBearer token to authenticate the API request.

Payloadโ€‹

PropertyTypeRequiredDefault ValueDescription
clientOrderNumberStringNoNoneThe order number assigned by the client, used for tracking and reference purposes.
๐Ÿ†•enableClientOrderNumberDupCheckBooleanNofalseEnable to prevent duplicate clientOrderNumber
skuStringYesThe 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 CodeDescription
200OK
400Bad Request
500Internal Server Error

Schemaโ€‹

PropertyTypeNullableDescription
requestIdStringNoUnique identifier assigned to each request for tracking purposes.
dataOrderResponseNoOrder response.

OrderResponseโ€‹

PropertyTypeNullableDescription
transactionIdStringNoThe transaction identifier.
clientOrderNumberStringNoThe client's order number.
grandTotalMoneyResponseNoThe grand total amount and currency.
createdAtStringNoTimestamp of when the order was created.
statusOrderStatusNoThe status of the order.
productsProductResponse[]NoList of products in the order.

ProductResponseโ€‹

PropertyTypeNullableDescription
skuStringNoThe SKU of the product.
quantityIntegerNoThe quantity of the product.
unitPriceMoneyResponseNoThe unit price of the product.
totalPriceMoneyResponseNoThe total price of the product.
statusOrderStatusNoThe status of the product.

MoneyResponseโ€‹

PropertyTypeNullableDescription
amountStringNoThe monetary amount.
currencyStringNoThe currency of amount.

OrderStatusโ€‹

ValueTypeDescription
PROCESSINGStringThe order is currently being processed.
COMPLETEDStringThe order has been completed successfully.
CANCELLEDStringThe 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"
}
]
}
}