Skip to main content

Send order payment update

Method#

/order-payment-update#

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

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

In this method, you can send messages to update the payment status of previously sent orders.

image


Important

This method is available only for WhatsApp Business accounts.


Attributes#

Required#

AttributesTypeDescription
phonestringRecipient's phone number in the format DDI DDD NUMBER, e.g., 551199999999. IMPORTANT: Send only numbers, without formatting or masks
messageIdstringID of the original WhatsApp message of the order
referenceIdstringReference ID of the order (returned in the webhook)
orderRequestIdstringOrder request reference ID (returned in the webhook)
orderStatusstringCurrent order status (pending, processing, shipped, completed, canceled) (returned in the webhook)
paymentStatusstringNew payment status (pending, paid)
orderobjectInformation about the order to be sent

Object (order)

AttributesTypeDescription
currencystringCurrency code
productsarray objectInformation about products related to the order

Object (products)

AttributesTypeDescription
productIdstringProduct ID (returned in the webhook)
namestringProduct name
valuenumberProduct value
quantitynumberQuantity
isCustomItembooleanIndicates if it's a custom product at the time of sending (returned in the webhook)

Optional#

AtributosTipoDescrição
messagestringText message

Object (order)

AttributesTypeDescription
discountnumberDiscount amount
taxnumberTax amount
shippingnumberShipping cost

Request Body#

Caution

In the request, you must include all the data previously provided when sending the order, with the addition of some mandatory additional parameters, which are returned in the webhook.

{
"phone": "554499999999",
"messageId": "3EB0F91BBA791BB0A787FC",
"message": "Order update text message",
"referenceId": "4N8FCTW1WM6",
"orderRequestId": "4N8FCTW22W4",
"orderStatus": "processing",
"paymentStatus": "paid",
"order": {
"currency": "BRL",
"discount": 10,
"tax": 10,
"shipping": 5,
"products": [
{
"value": 150,
"quantity": 2,
"name": "order 1",
"isCustomItem": true,
"productId": "custom-item-4N8FCTW23N7"
},
{
"productId": "23940797548900636",
"value": 150,
"quantity": 2,
"name": "order 2",
"isCustomItem": false
}
]
}
}
Tip

You can notice that the product with the "isCustomItem" attribute set to true has an ID with the "custom-item" prefix. This occurs when no product ID is provided when sending an order, meaning WhatsApp assumes it's a custom product. This ID is returned in the webhook and is a mandatory parameter, along with "isCustomItem," for order updates.

Response#

200#

AttributesTypeDescription
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#