Webhooks
Webhooks
Webhooks are HTTP-based real-time push notifications that OwnGateway would use for instant status communication to your server. Webhooks are vital in payments for the following reasons:
- Preventing merchants from losing business due to delayed status communication (say, in case of flight or movie reservations where there is a need for instant payment confirmation).
- Prevent payment reconciliation issues where payments change from “Failed” to “Succeeded”.
- Providing the best payment experience for the end-user by instantly communicating payment status and fulfilling the purchase.
Configuring Webhooks
- Create an endpoint on your server
You would need to set up a dedicated HTTPS or HTTP endpoint on your server with a URL as a webhook listener that will receive push notifications in the form of a POST request with JSON payload from the OwnGateway server
- Update your webhook endpoint on OwnGateway Dashboard
Update the above endpoint on your OwnGateway dashboard under Settings -> Webhooks
- Update OwnGateway webhook endpoints on your connector Dashboard
In order for OwnGateway to receive updates from the connectors you have selected, you would need to update OwnGateway's corresponding endpoints on your respective connector dashboard instead of your webhook endpoints.
OwnGateway’s webhook endpoint format is as follows:
Environment Webhook Endpoint Sandbox
sandbox.owngateway.io/webhooks/{merchant_id}
/{connector_name}
Production
api.owngateway.io/webhooks/{merchant_id}
/{connector_name}
Handling Webhooks
Select the events for Webhooks: On the same page on the dashboard, select the events for which you would like to receive notifications. Currently, Webhooks are available on OwnGateway for the following events:
- payment_succeeded
- payment_failed
- payment_processing
- action_required
- refund_succeeded
- refund_failed
- dispute_opened
- dispute_expired
- dispute_accepted
- dispute_cancelled
- dispute_challenged
- dispute_won
- dispute_lost
Return a 2xx response: Your server must return a successful 2xx response on successful receipt of webhooks.
Retries: In case of 3xx, 4xx, or 5xx response or no response from your endpoint for webhooks, OwnGateway has a retry mechanism that tries sending the webhooks again up to 3 times before marking the event as failed.