A webhook is an HTTP endpoint that receives events from Zwitch. Webhooks allow you to be notified about payment events.
You can set up webhooks from your Dashboard and configure separate URLs for live and sandbox modes.
Setup Webhook URL
To set webhooks:
- Log into your Zwitch Dashboard and navigate to the Developers section.
- Click on the PG API Keys
- Inside Developer API, setup your Webhook URLs
- Click Save to enable Webhooks.
{
"amount": "55.30",
"currency": "INR",
"mtx": null,
"attempts": 1,
"id": "pt_BRgoBYuhcr4Q3Jz",
"entity": "payment_token",
"status": "paid",
"udf": {
"jithi": "ssss",
"test": "test"
},
"event": "payment_token_paid",
"payment": {
"amount": "55.30",
"currency": "INR",
"payment_error_code": null,
"payment_error_description": null,
"id": "py_BRgoBjah1ICsqXE",
"entity": "payment",
"status": "captured",
"payment_instrument": {
"entity": "payment_instrument",
"id": 1000,
"name": "mock",
"type_id": 1000,
"type_name": null
},
"customer": {
"contact_number": "8682008771",
"email_id": "[email protected]",
"id": "cs_BRaSbZJUZUQvJUp",
"entity": "customer"
},
"card": {
"customer_id": "cs_BRaSbZJUZUQvJUp",
"card_type": "2",
"card_network": "visa",
"id": "sb_card_attr_BRetpEQTRDszw27",
"entity": "card"
}
}
}
The table below lists the webhook events available for Payments.
Webhook Event | Description |
---|---|
payment_captured | Triggered when a payment is successfully completed. |
payment_failed | Triggered when a payment failed |
payment_pending | Triggered when a payment is in a pending state |
payment_cancelled | Triggered when a payment is cancelled |
payment_token_created | Triggered when a payment token is created |
payment_token_attempted | Triggered when payment for a payment token has been initiated |
payment_token_paid | Triggered when payment for a payment token has been successful |