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]"
}
AttributeDatatypeValueDescription
idStringOrder1Unique identifier for the order.
createdAtString2021-07-29T20:59:23.383ZUTC date-time when order was created.
updatedAtString2021-07-30T10:59:23.383ZUTC date-time when order is changed/updated.
statusStringCompletedTransactional status of the order.
amountNumber308Total cost of the order including shipping and taxes etc.
productsArray of objectsId of the product, quantity, price etc.The assorted products in the order.
emailString[email protected]Email address of the customer.
billingObjectAddress, city, phone, postcode etc.Billing details of the order.
couponsArray of stringsTest100Coupons 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.

AttributeDatatypeValueDescription
productIdStringP1ID of the product.
quantityNumber3How many products the visitor has added to the cart.
variantIdStringP12Product ID of the red colour shirts.
priceNumber20The 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.

AttributeDatatypeValueDescription
addressString15 Somewhere Road, BrynmenynFull billing address.
cityStringBaselExact city of the address.
countryCodeStringCABilling country 2-letter ISO code.
phoneString01559 032133Phone number to contact for further details about the order, Mandatory if "email" field is not passed.
postCodeString40523Postcode for delivery and billing.
paymentMethodStringPaypalHow the visitor will pay for the item(s), e.g. Paypal, Check, etc.
regionStringNorthwestern SwitzerlandExact 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/batchwith 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.

AttributeDatatypeValueDescription
ordersArray of objectsValue of batch of ordersArray of order objects
idStringOrder1Unique id of the order
createdAtString2021-07-29T20:59:23.383ZEvent occurrence UTC date-time, when order is actually created.
updatedAtString2021-07-30T10:59:23.383ZEvent updated UTC date-time, when the status of the order is actually changed/updated.
statusStringCompletedStatus of the order
amountNumber308.42Total amount of the order, including all shipping expenses, tax and the price of items.
productsArray of objectsId of the product, quantity and price.Assorted products in the order.
emailString[email protected]Email of the contact, Mandatory if "phone" field is not passed in "billing" parameter.
billingObjectBilling details like address, city, post code etc.Billing details of an order
couponsArray of stringsTEST100Coupons applied to the order.
notifyUrlStringhttps://en.wikipedia.org/wiki/WebhookNotify 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.

AttributeDatatypeValueDescription
productIdStringP1ID of the product.
quantityNumber3How many products the visitor has added to the cart.
variantIdStringP12Product ID of the red colour shirts.
priceNumber20The 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.

AttributeDatatypeValueDescription
addressString15 Somewhere Road, BrynmenynFull billing address.
cityStringBaselExact city of the address.
country codeStringCABilling country 2-letter ISO code.
phoneString01559 032133Phone number to contact for further details about the order, Mandatory if "email" field is not passed.
postCodeString40523Postcode for delivery and billing.
paymentMethodStringPaypalHow the visitor will pay for the item(s), e.g. Paypal, Check, etc.
regionStringNorthwestern SwitzerlandExact region (state/province) for delivery and billing.

Responses you should expect

Response codeMessageDescription
204Order event postedOrder event has been created.
202Batch id createdBatch id has been created and request successfully completed
400Bad requestBad request
{
  "batch_id": xxxxxx
}