Receive WhatsApp Payments via Payment Links
Integration Steps
The steps outlined below assume that the business is about to send order details message to consumer client.
The following sequence diagram demonstrates the typical integration flow for WA Payments API:
Get Payment Link from Payment Gateway
Once the consumer has expressed their interest to purchase an item using payment link. Business needs to call payment gateway with necessary information like reference-id, amount and validity to generate the payment link. Following is a sample payment link:
https://rzp.io/i/rNiAagU8yBusiness needs to use the same reference-id, amount and expiration in invoice(order_details) interactive message.
Add Common Message Parameters
Once the interactive object is complete, append the other parameters that make a message: recipient_type, to, and type. Remember to set the type to interactive.
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "PHONE_NUMBER",
"type": "interactive",
"interactive": {
// interactive object here
}
}Make a POST Call to Messages Endpoint
Make a POST call to the /messages endpoint with the JSON object you have assembled. If your message is sent successfully, you get the following response:
{
"messaging_product": "whatsapp",
"contacts": [ {
"input": "[PHONE_NUMBER_ID]",
"wa_id": "[PHONE-NUMBER_ID]"
} ],
"messages": [ {
"id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA"
} ]
}Get Notified About Transaction Status Updates from payment gateway
Businesses receive updates to the invoice via payment gateway webhooks, when the status of the user-initiated transaction changes. The unique identifier reference-id passed in order_details message can be used to map the transaction to the consumer invoice or interactive order details message.
Update order status
Upon receiving transaction signals from payment gateway through webhook, the business must update the order status to keep the user up to date. Currently we support the following order status values:

pending
User has not successfully paid yet
processing
User payment authorized, merchant/partner is fulfilling the order, performing service, etc.
partially-shipped
A portion of the products in the order have been shipped by the merchant
shipped
All the products in the order have been shipped by the merchant
completed
The order is completed and no further action is expected from the user or the partner/merchant
canceled
The partner/merchant would like to cancel the order_details message for the order/invoice. The status update will fail if there is already a successful or pending payment for this order_details message
Typically businesses update the order_status using either the WhatsApp payment status change notifications or their own internal processes. To update order_status, the partner sends an order_status message to the user.
Last updated
Was this helpful?