Manage your orders
Managing the status and batch of orders
You can manage your orders seamlessly through the eCommerce platform. You can see all the endpoints for eCommerce order management in the API reference here.
Requirements
To create and manage your eCommerce store orders you need to have access to the Brevo eCommerce application. If you are not already integrated with the eCommerce feature you can go to eCommerce > Activate the eCommerce App.
Managing the status of the order
To manage the transactional status of the order, you have to use the endpoint https://api.brevo.com/v3/orders/status
with the method POST
. The cURL request to create orders is as follows:
curl --request POST \
--url https://api.brevo.com/v3/orders/status \
--header 'accept: application/json' \
--header 'api-key:<YOUR CREDENTIALS> ' \
--header 'content-type: application/json' \
--data '
{
"products": [
{
"productId": "P1",
"quantity": 10,
"variantId": "P100",
"price": 99.99
}
],
"billing": {
"address": "15 Somewhere Road, Brynmenyn",
"city": "Basel",
"countryCode": "CA",
"phone": "01559 032133",
"postCode": "4052",
"paymentMethod": "PayPal",
"region": "Northwestern Switzerland"
},
"coupons": [
"test"
],
"id": "1",
"createdAt": "2021-07-29T20:59:23.383Z",
"updatedAt": "2021-07-30T10:59:23.383Z",
"status": "completed",
"amount": 308.42,
"email": "[email protected]"
}
Attribute | Datatype | Value | Description |
---|---|---|---|
id | String | Order1 | Unique identifier for the order. |
createdAt | String | 2021-07-29T20:59:23.383Z | UTC date-time when order was created. |
updatedAt | String | 2021-07-30T10:59:23.383Z | UTC date-time when order is changed/updated. |
status | String | Completed | Transactional status of the order. |
amount | Number | 308 | Total cost of the order including shipping and taxes etc. |
products | Array of objects | Id of the product, quantity, price etc. | The assorted products in the order. |
email | String | [email protected] | Email address of the customer. |
billing | Object | Address, city, phone, postcode etc. | Billing details of the order. |
coupons | Array of strings | Test100 | Coupons applied to order at checkout. |
Products and billings
💡Note products and billing are different objects. Their parameters are explained below.
Products attribute
💡 Products attribute is a sub-attribute for orders. It is an array of objects that represents all the products in an order. Its attributes are mentioned in the table below.
Attribute | Datatype | Value | Description |
---|---|---|---|
productId | String | P1 | ID of the product. |
quantity | Number | 3 | How many products the visitor has added to the cart. |
variantId | String | P12 | Product ID of the red colour shirts. |
price | Number | 20 | The price of a unit of a product. |
Billing attribute
💡Billing attribute is also a sub-attribute for orders. It is an object that includes the details of the order delivery and its region. Its attributes are mentioned below in the table.
Attribute | Datatype | Value | Description |
---|---|---|---|
address | String | 15 Somewhere Road, Brynmenyn | Full billing address. |
city | String | Basel | Exact city of the address. |
countryCode | String | CA | Billing country 2-letter ISO code. |
phone | String | 01559 032133 | Phone number to contact for further details about the order, Mandatory if "email" field is not passed. |
postCode | String | 40523 | Postcode for delivery and billing. |
paymentMethod | String | Paypal | How the visitor will pay for the item(s), e.g. Paypal, Check, etc. |
region | String | Northwestern Switzerland | Exact region (state/province) for delivery and billing. |
Managing the batch of orders
You have to use the endpoint https://api.brevo.com/v3/orders/status/batch
with the POST
for calling this API. This endpoint is used to create multiple orders at one time instead of one order at a time. You can check it out at eCommerce > Maintains a batch of orders.
The cURL request is as following:
curl --request POST \
--url https://api.brevo.com/v3/orders/status/batch \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
Limits
You can create up to 1000 orders in a batch or 5MB of orders in size.
{
"orders": [
{
"id": "order30",
"status": "completed",
"amount": 1000,
"email": "[email protected]",
"createdAt": "2021-07-27T08:52:14.111Z",
"updatedAt": "2021-07-27T08:52:14.948Z",
"Products": [
{
"productId": "600",
"quantity": 899,
"price": 1
},
{
"productId": "100",
"quantity": 500,
"price": 1
},
{
"productId": "100",
"variantId": "12",
"quantity": 100,
"price": 1
}
],
"coupons": [
"TEST100"
],
"billing": {
"address": "newAddress",
"city": "Noida",
"phone": "919860038202"
}
},
{
"Id": "order31",
"status": "completed",
"amount": 1000,
"email": "[email protected]",
"createdAt": "2021-07-27T08:52:14.111Z",
"updatedAt": "2021-07-27T08:52:14.948Z",
"Products": [
{
"productId": "900",
"quantity": 999,
"price": 1
},
{
"productId": "500",
"quantity": 800,
"price": 1
},
{
"productId": "800",
"variantId": "12",
"quantity": 800,
"price": 1
}
],
"coupons": [
"TESTy00"
],
"billing": {
"address": "newAddress",
"city": "Noida",
"phone": "919860038202"
}
}
],
"notifyUrl": "www.testnotify.com"
}
The attributes and parameters of batch orders and creating orders are equal except batch orders contains multiple orders so the attributes of orders are created in batches. The only attribute that is different in batch orders is notifyUrl
.
Attribute | Datatype | Value | Description |
---|---|---|---|
orders | Array of objects | Value of batch of orders | Array of order objects |
id | String | Order1 | Unique id of the order |
createdAt | String | 2021-07-29T20:59:23.383Z | Event occurrence UTC date-time, when order is actually created. |
updatedAt | String | 2021-07-30T10:59:23.383Z | Event updated UTC date-time, when the status of the order is actually changed/updated. |
status | String | Completed | Status of the order |
amount | Number | 308.42 | Total amount of the order, including all shipping expenses, tax and the price of items. |
products | Array of objects | Id of the product, quantity and price. | Assorted products in the order. |
email | String | [email protected] | Email of the contact, Mandatory if "phone" field is not passed in "billing" parameter. |
billing | Object | Billing details like address, city, post code etc. | Billing details of an order |
coupons | Array of strings | TEST100 | Coupons applied to the order. |
notifyUrl | String | https://en.wikipedia.org/wiki/Webhook | Notify Url provided by client to get the status of batch request |
💡Products and billing are objects so their parameters will be mentioned below in another table.
Products attribute
💡 Products attribute is a sub-attribute for orders. It is an array of objects that represents all the products in an order. Its attributes are mentioned in the table below.
Attribute | Datatype | Value | Description |
---|---|---|---|
productId | String | P1 | ID of the product. |
quantity | Number | 3 | How many products the visitor has added to the cart. |
variantId | String | P12 | Product ID of the red colour shirts. |
price | Number | 20 | The price of a unit of a product. |
Billing attribute
💡Billing attribute is also a sub-attribute for orders. It is an object that includes the details of the order delivery and its region. Its attributes are mentioned below in the table.
Attribute | Datatype | Value | Description |
---|---|---|---|
address | String | 15 Somewhere Road, Brynmenyn | Full billing address. |
city | String | Basel | Exact city of the address. |
country code | String | CA | Billing country 2-letter ISO code. |
phone | String | 01559 032133 | Phone number to contact for further details about the order, Mandatory if "email" field is not passed. |
postCode | String | 40523 | Postcode for delivery and billing. |
paymentMethod | String | Paypal | How the visitor will pay for the item(s), e.g. Paypal, Check, etc. |
region | String | Northwestern Switzerland | Exact region (state/province) for delivery and billing. |
Responses you should expect
Response code | Message | Description |
---|---|---|
204 | Order event posted | Order event has been created. |
202 | Batch id created | Batch id has been created and request successfully completed |
400 | Bad request | Bad request |
{
"batch_id": xxxxxx
}
Updated 12 months ago