This endpoint allows you to create new orders programmatically in your Venddor store. Orders can be created on behalf of existing users or as guest checkouts.
"status": "O"
(Open). You can change the status only when updating an existing order.
Pass the following parameters in the HTTP request body according to your specified Content-Type
:
Parameter | Type | Required | Description |
---|---|---|---|
user_id* | integer | Yes | The unique identifier of the user. Can be omitted or set to 0 only if the request includes user_data . |
payment_id* | integer | Yes | ID of the payment method. The payment method must be available in the store. |
shipping_id* | mixed | Yes | ID of the shipping method or an array of shipping method IDs (for multiple product groups). The shipping method must be available in the store and configured for the shipping address. |
shipping_id
. The keys of the array would be the keys of the product groups in the cart. This is useful for orders with products from multiple vendors, suppliers, or when products are separated into groups.
Parameter | Type | Required | Description |
---|---|---|---|
products* | object | Yes | An object with information about the ordered products. Can be structured in two different ways (see below). |
"products": { "241": { "amount": "1", "product_options": { "12": "44", "13": "48" } } }
"products": { "1": { "product_id": "12", "amount": "1", "product_options": { "3": "12", "4": "17" } }, "2": { "product_id": "12", "amount": "2", "product_options": { "3": "15", "4": "19" } } }
Parameter | Type | Required | Description |
---|---|---|---|
user_data | object | Conditional | Required if user_id is omitted or set to 0. Contains customer data for guest checkout. |
Field | Type | Required | Description |
---|---|---|---|
email* | string | Yes | Customer's email address |
b_firstname* | string | Yes | First name (billing address) |
b_lastname* | string | Yes | Last name (billing address) |
b_address* | string | Yes | Street address (billing) |
b_city* | string | Yes | City (billing) |
b_state* | string | Yes | State code (billing) - 2 characters |
b_country* | string | Yes | Country code (billing) - 2 characters |
b_zipcode* | string | Yes | Zip/Postal code (billing) |
b_phone* | string | Yes | Phone number (billing) |
s_firstname* | string | Yes | First name (shipping) |
s_lastname* | string | Yes | Last name (shipping) |
s_address* | string | Yes | Street address (shipping) |
s_city* | string | Yes | City (shipping) |
s_state* | string | Yes | State code (shipping) - 2 characters |
s_country* | string | Yes | Country code (shipping) - 2 characters |
s_zipcode* | string | Yes | Zip/Postal code (shipping) |
s_phone* | string | Yes | Phone number (shipping) |
{ "user_id": "3", "shipping_id": "1", "payment_id": "2", "products": { "1": { "product_id": "12", "amount": "1" }, "2": { "product_id": "13", "amount": "2" } } }
This request creates an order with the following properties:
user_id=3
shipping_id=1
payment_id=2
product_id=12
and two products with product_id=13
{ "user_id": "0", "payment_id": "2", "shipping_id": "1", "products": { "1": { "product_id": "12", "amount": "1" }, "2": { "product_id": "13", "amount": "2" } }, "user_data": { "email": "guest@example.com", "firstname": "Guest", "lastname": "Guest", "s_firstname": "Guest", "s_lastname": "Guest", "s_country": "US", "s_city": "Boston", "s_state": "MA", "s_zipcode": "02125", "s_address": "44 Main street", "b_firstname": "Guest", "b_lastname": "Guest", "b_country": "US", "b_city": "Boston", "b_state": "MA", "b_zipcode": "02125", "b_address": "44 Main street" } }
user_data
object when creating an order for a guest.
{ "order_id": "98" }
Returned when the order couldn't be created due to invalid parameters or other issues.
When creating orders, consider the following best practices: