Skip to main content
Version: 2.0

Webhook and Redirection

Webhook Notifications

Webhook Endpoint Configuration:

  • When creating the payment context, specify a webhook URL where payment status notifications should be sent.
  • This endpoint will receive a POST request each time the payment status changes.

Webhook Payload:

  • The webhook payload contains key transaction details such as:
    • payment_status: Status of the payment (Success, Failed, Pending, etc.).
    • amount: Total transaction amount.
    • currency: The currency used in the transaction.
    • order_id: Unique identifier for the order.
  • Use this data to update your internal order records accordingly.

Typical Payment Statuses:

  • Success: Payment was successfully completed.
  • Failed: Payment could not be processed.
  • Pending: Payment is still in process.

Redirection URLs

Post-Payment Redirection:

  • During payment context creation, provide a redirect URL. This URL is used to redirect the customer after payment completion.
  • It helps guide customers to the appropriate page, such as a "Thank You" or "Payment Failed" page, improving their experience.

Handling Redirects:

  • The redirect URL includes query parameters: ?payment_id=%v&order_id=%v&status=%v.
    • payment_id: Unique identifier for the payment.
    • order_id: Unique identifier provided during the payment context creation.
    • status: Result of the payment (Success, Failed, Pending).
  • Implement logic to handle these parameters to correctly update the user interface based on the payment outcome.

Summary:

  • Webhook Notifications are for server-side updates, keeping your backend synchronized with payment status.
  • Redirect URLs manage the customer’s experience, ensuring they are guided to the right page after completing the payment.