Create Order
POST/Order/create
Creates a new order on behalf of the authenticated API customer.
How it works
- Each item in
basketDatarepresents a single product line in the order. - The
DeliverIDfield on every basket item is your own correlation id. It is echoed back in the response and in every later delivery callback so you can match the order to a record in your own system. - The
RequireDatacollection on each basket item carries values you collected from the customer (game user id, character name, phone number, etc.). It must follow the same shape returned by the product listing endpoints underrequireData. BillingAddressIDis a billing address id that already belongs to your API customer.NotifyURLis the HTTPS endpoint on your side that will receive the delivery callback (see Order Delivery Webhook).
RequireData example
{
"productRequireID": 1,
"identifier": "userid",
"title": "Your character name in the game",
"value": "Player"
}
Sample request body
{
"basketData": [
{
"DeliverID": "your_deliver_id",
"CustomerStoreProductID": 1,
"Quantity": 1,
"RequireData": [
{ "ProductRequireID": 1, "Identifier": "userid", "Value": "12341234" }
]
}
],
"BillingAddressID": 1234,
"NotifyURL": "https://your-domain.com/notify-order-callback"
}
Sample response
{
"data": {
"OrderID": 9876,
"details": [
{
"DeliverID": "your_deliver_id",
"OrderDetailID": 55501,
"Quantity": 1,
"Price": 19.90
}
],
"items": null
},
"success": true,
"message": "OK"
}
When success is false, the items array contains the basket lines
that could not be ordered together with the reason (e.g. out of stock,
price changed). No order is created in that case.
Sample code (C# / .NET)
var http = new HttpClient { BaseAddress = new Uri("{API_SERVER}/order/create") };
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "{token}");
var orderRequestApiDTO = new
{
basketData = new[]
{
new
{
DeliverID = "your_deliver_id",
CustomerStoreProductID = 1,
Quantity = 1,
RequireData = new[]
{
new { ProductRequireID = 1, Identifier = "userid", Value = "12341234" }
}
}
},
BillingAddressID = 1234,
NotifyURL = "https://your-domain.com/notify-order-callback"
};
var content = new StringContent(
JsonConvert.SerializeObject(orderRequestApiDTO),
Encoding.UTF8,
"application/json");
var response = await http.PostAsync("", content);
if (!response.IsSuccessStatusCode) return;
var result = await response.Content
.ReadAsJsonAsync<DataResult<OrderResponseApiDTO>>();
if (!result.Success)
{
if (result.Data?.items != null)
{
foreach (var item in result.Data.items)
{
logger.Warn(
$"#{item.ProductID} (x{item.Quantity}) {item.StoreName}: {item.reason}");
}
}
return;
}
if (result.Data.details.Count == 0)
{
logger.Error("Create order request failed: details cannot be empty.");
return;
}
Authentication and availability
- Requires a valid API customer. Otherwise the response is
401 Unauthorized. - Available only when the API integration is enabled.
Request
Responses
- 200
- 400
- 401
- 403
- 404
The order was created successfully and an OrderResponseApiDTO is returned.
The request payload is invalid or one or more basket items could not be ordered.
The caller is not an authorized API customer.
Forbidden
The API integration is disabled for this tenant.