Skip to main content

Send approve order message

Method#

/send-order#

POST https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/send-order

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

With this method, you can send order messages containing products from your catalog or custom products created at the time of sending. Remembering that this message is the same one that is sent when you click on the "Accept order" - or "Send billing" - button on the customer's order. Such a message returns in the webhook information about the order as well as the data required for status updates and payment, which in turn, are also messages, which reference the main message of the order, that is, the message sent from this route.

image


Important

This method is available only for WhatsApp Business accounts.


Attributes#

Required#

AttributeTypeDescription
phonestringRecipient's phone number in the format DDI DDD NUMBER, e.g., 551199999999. IMPORTANT: Send only numbers, without formatting or masks.
orderobjectInformation about the order to be sent
paymentSettingsobjectPayment settings (for cards to work, it must be configured in the WhatsApp account on the cell phone)

Object (order)

AttributeTypeDescription
currencystringCurrency code
productsarray objectInformation about products related to the order

Object (products)

AttributeTypeDescription
namestringProduct name
valuenumberProduct value
quantitynumberQuantity

Optional#

Object (order)

AttributeTypeDescription
discountnumberDiscount amount
taxnumberTax amount
shippingnumberShipping cost

Object (products)

AttributeTypeDescription
productIdstringCatalog product ID

Object (paymentSettings)

AtributosTipoDescrição
pixobjectInformation about PIX key
cardobjectEnable card payment

Object (pix)

AtributosTipoDescrição
keystringPIX Key
keyTypestringKey type (cpf, cnpj, phone, email, randomKey)
namestringKey name

Object (card)

AtributosTipoDescrição
enabledbooleanEnable card payment

Request Body#

Including optional parameters#

{
"phone": "554499999999",
"order": {
"currency": "BRL",
"discount": 10,
"tax": 10,
"shipping": 5,
"products": [
{
"productId": "23940797548900636",
"name": "Product Name",
"value": 10,
"quantity": 2
}
]
},
"paymentSettings": {
"pix": {
"key": "PIX Key",
"keyType": "Key type (cpf | cnpj | phone | email | randomKey)",
"name": "Key name"
},
"card": {
"enabled": true
}
}
}

Only required parameters#

{
"phone": "554499999999",
"order": {
"currency": "BRL",
"products": [
{
"name": "Product Name",
"value": 150,
"quantity": 1
}
]
}
}
Tip

When sending a product in the "products" list without the "productId" attribute, it is considered a "custom product." It receives an ID to be used in the context of this order, which is returned in the webhook of ReceivedCallback and should be used for order status updates.

Response#

200#

AttributeTypeDescription
zaapIdstringz-api ID
messageIdstringWhatsApp ID
idstringAdded for compatibility with Zapier; it has the same value as messageId

Example

{
"zaapId": "3999984263738042930CD6ECDE9VDWSA",
"messageId": "D241XXXX732339502B68",
"id": "D241XXXX732339502B68"
}

405#

In this case, ensure that you are correctly following the method specification, i.e., check if you sent the POST or GET as specified at the beginning of this topic.

415#

If you receive a 415 error, make sure to add the "Content-Type" of the object you are sending to the request headers, which is usually "application/json."


Webhook Response#

Link to the webhook response (upon receiving)

Webhook


Code#