Webhooks allow you to get notified of events that happen on Instamojo.
For example, when a buyer makes payment, Instamojo can send an HTTP POST request to your server. This avoids the need to keep polling Instamojo servers for updates.
A webhook is not a redirect. The buyer or the browser will never see it. Its a communication channel between Instamojo servers and your servers.
Here are some use cases where a webhook might be useful:
- Sending a custom email from your server at the end of every transaction
- Activation of a user's account on your service
- Sending a user the license key to your software
- Adding a user to your CRM software
- Adding the transaction to your accounting software
By default, a webhook is sent only on successful payments, but can be enabled
for failures too. Please get in touch with [email protected] for the same.
A webhook URL should be an internet facing publicly accessible URL on your server, which accepts a POST request from instamojo.com. CSRF checks should be disabled and if the server is hosted over HTTPS, the SSL certificate should be valid and not expired. The URL should not have any kind of authentication.
We have a handy [https://www.instamojo.com/webhook-testing-tool/](webhook testing tool) which can be used to test your server. [https://requestb.in/](Request bin) is a useful service to explore the request sent by the server.
The webhook request is request with content-type application/www-form-urlencoded
. Don't try to handle it like a JSON request.
The parameters for Payment requests are
Key | Description |
---|---|
amount | Amount related to the payment |
buyer | Buyer's email |
buyer_name | Buyer's name |
buyer_phone | Buyer's phone number |
currency | Currency related to the payment |
fees | Fees charged by Instamojo |
longurl | URL related to the payment request |
mac | Message Authentication code of this webhook request |
payment_id | ID of the payment |
payment_request_id | ID of the payment request |
purpose | Purpose of the Payment request |
shorturl | Short URL of the payment request |
status | Status of the Payment. This can be either "Credit" or "Failed". |
NOTE: This list of keys will get updated over time. So when you are integrating,
we recommend you to account for new keys that will be added to this.