Generate a payment link inside a WhatsApp flow and send it to the customer in the same message. This guide covers every field in the External API Request step for Razorpay's payment links endpoint.
Razorpay is the most widely used payment gateway in India. The External API Request step lets your WhatsApp bot generate a payment link on the fly, capture the link from the API response, and send it to the customer in the same conversation, all without leaving WhatsApp or opening a browser.
The most useful thing to do with the Razorpay API inside WhatsApp is create a payment link. The link is a hosted Razorpay checkout page the customer can pay on using UPI, cards, or net banking. This guide focuses on exactly that.
New to the External API Request step? Read the foundation guide first.
Razorpay gives you separate test and live credentials. Use the test key while building your flow; no real money moves. Switch to the live key only when you are ready to accept actual payments. The API endpoint and request format are identical for both.
Razorpay uses HTTP Basic Auth. In the External API Request step, select Basic Auth and enter your Key ID as the username and your Key Secret as the password. The step handles the base64 encoding for you. The resulting header looks like Authorization: Basic ENCODED_STRING.
https://api.razorpay.com/v1/payment_linksRazorpay takes the amount field in the smallest currency unit. For INR that is paise: 1 rupee = 100 paise. So to create a link for Rs 500, set amount to 50000. This is the most common mistake in first integrations.
{
"amount": 50000,
"currency": "INR",
"description": "Payment for Order #{{order_id}}",
"customer": {
"name": "{{customer_name}}",
"contact": "{{customer_phone}}",
"email": "{{customer_email}}"
},
"notify": {
"sms": false,
"email": false
},
"reminder_enable": false,
"callback_url": "https://yoursite.com/payment-success",
"callback_method": "get"
}Set notify.sms and notify.email to false if you are sending the link manually via WhatsApp, so the customer does not receive a duplicate notification from Razorpay. Map {{order_id}}, {{customer_name}}, etc. from your flow.
The response from the payment links endpoint contains a short_url field. That is the URL to send to the customer.
{
"id": "plink_ExjpAYRITq5Sm6",
"short_url": "https://rzp.io/i/nxrHnLJ",
"status": "created",
"amount": 50000,
"currency": "INR"
}Map short_url from the response into the next WhatsApp message step. The message might read: 'Your payment link for Rs 500 is ready. Please pay here: {{payment_link}}'. The customer taps it and completes payment on Razorpay's hosted page.
A customer books a service through your WhatsApp chatbot. The bot captures the booking details and the amount, then calls the Razorpay step to create a link for the deposit amount.
{
"amount": {{deposit_amount_paise}},
"currency": "INR",
"description": "Deposit for {{service_name}} booking",
"customer": {
"name": "{{customer_name}}",
"contact": "91{{customer_phone}}"
},
"notify": {
"sms": false,
"email": false
},
"expire_by": {{expiry_timestamp}},
"reminder_enable": true
}The bot then sends: 'Great! Here is your deposit link for {{service_name}}: {{short_url}}. Please pay within 24 hours to confirm your booking.' Once the customer pays, Razorpay triggers your callback URL and the flow can send a confirmation message.
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong keys or incorrect Basic Auth encoding | Re-check Key ID and Key Secret; confirm you are using the correct mode (test vs live) |
| Amount too small error | Amount below Razorpay's minimum (usually Rs 1) | Ensure amount is in paise and is at least 100 (Rs 1) |
| 422 Unprocessable | Invalid phone number format in customer.contact | Indian mobile numbers should include the country code: 91XXXXXXXXXX |
| Link not opening | Test key in use but trying with production link checker | Normal; test links only work in Razorpay test mode |
| Payment confirmation not arriving | No callback URL set or URL not publicly reachable | Set callback_url to a public endpoint; localhost will not work |
Razorpay returns detailed error messages in the error field of the response JSON.
Every field explained, the foundation guide.
Read guide →Custom headers instead of Basic Auth, create orders directly.
Read guide →Bearer auth, INR support, for businesses serving international customers.
Read guide →Automate follow-up on unpaid links.
Read guide →Use native Flows to collect payment inside the chat.
Read guide →All connection guides.
Browse all →Free trial, no credit card required. And if you ever get stuck, we are the only platform in India that answers you live on WhatsApp.