Create an order
create_orderCreate an order. Saves the order like the portal's order form and returns it. Requires the previewToken of an order preview of exactly this order: without it the result is preview_required (422), and if the order or its price changed since the preview it is preview_changed (409). Creating an order doesn't charge the wallet. When the order has no problems, its stock is reserved and the estimated shipping and handling fee is held from the available balance. When the warehouse weighs the parcel, the shipping and handling fee is charged to the wallet automatically. If auto purchase is on and an order is short of stock, a purchase order is placed and paid automatically, within the limits set on the account. An order with problems is saved with status NEEDS_ATTENTION. A retry with the same idempotencyKey returns the first result instead of creating it twice. Needs the orders:write permission.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"idempotencyKey": "<idempotencyKey>",
"previewToken": "<previewToken>"
},
"name": "create_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | No | ||
| lines | No | The items in the order | |
| address1 | No | ||
| address2 | No | ||
| province | No | ||
| buyerNote | No | ||
| channelId | No | A shipping option from an order preview (shippingOptions[].channelId). Leave empty to use your shipping preference for the country. | |
| postalCode | No | ||
| countryCode | No | Two-letter country code, for example US | |
| previewToken | Yes | The previewToken from an order preview of exactly this order | |
| storeOrderNo | No | Your store's order number, unique among your orders. Leave empty to use our order number. | |
| recipientName | No | ||
| idempotencyKey | Yes | Make up a new unique value for each new action; reuse the same value only when retrying the same action. | |
| recipientEmail | No | ||
| recipientPhone | No | ||
| recipientCompany | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| replayed | No | true when this is the saved result of an earlier call with the same idempotencyKey |