Skip to main content

Overview

When you use webhookMode: true in payment requests, payment results are delivered to your configured webhook endpoints instead of being returned in the HTTP response. This page covers how to receive, verify, and process these webhook payloads.

Event Types


Webhook Payload Structure

All webhook payloads follow this structure:

Payload Fields

string
required
The type of event that triggered this webhook.Values: payment.completed, payment.failed, payment.cancelled, payment.timeout
string
required
Unique identifier for this event. Use this for idempotency checks.Example: "evt_01HQ3K4M5N6P7R8S9T0UVWXYZ"
string
required
ISO 8601 timestamp of when the event occurred.
object
required
Event-specific payload data containing the payment result.

Event Payload Examples

payment.completed

payment.failed

payment.cancelled

payment.timeout


Signature Verification

All webhook requests include headers for signature verification. You must verify signatures to ensure webhooks are authentic and haven’t been tampered with.

Webhook Headers

Verification Algorithm

  1. Extract headers: webhook-id, webhook-timestamp, webhook-signature
  2. Check timestamp is within 5-minute tolerance window
  3. Construct signed content: ${webhook-id}.${webhook-timestamp}.${raw-body}
  4. Compute HMAC-SHA256 using your webhook secret (base64-decoded)
  5. Compare computed signature with provided signature
Always verify signatures before processing webhooks. Reject requests with invalid or expired signatures.

Node.js Example

Python Example


Response Requirements

Your webhook endpoint must respond according to these requirements:
If your endpoint doesn’t respond with a 2xx status within 15 seconds, the webhook is considered failed and will be retried.

Retry Schedule

After all retries are exhausted, the webhook delivery is marked as failed. You can query the transaction status using GET /v1/transactions/{transactionId} to reconcile any missed webhooks.

Best Practices

Use the eventId field to ensure you don’t process the same event twice. Store processed event IDs and skip duplicates:
Respond to webhooks immediately, then process asynchronously:
Subscribe to all relevant event types and handle each appropriately:
  • Always verify webhook signatures
  • Use HTTPS endpoints only
  • Validate the webhook-timestamp is recent
  • Consider IP allowlisting if available

Troubleshooting

Common causes:
  • Using the wrong webhook secret
  • Modifying the payload before verification (e.g., parsing JSON first)
  • Clock skew exceeding 5-minute tolerance
  • Decoding the secret incorrectly (must be base64-decoded)
Solutions:
  1. Verify you’re using the secret from endpoint creation
  2. Use the raw request body for signature verification
  3. Ensure your server clock is synchronized with NTP
  4. Base64-decode the secret before computing HMAC
Check:
  1. Endpoint URL is publicly accessible
  2. Endpoint is not returning errors
  3. Firewall allows incoming HTTPS connections
  4. Endpoint status is active (not disabled)
  5. You’re subscribed to the relevant event types
Cause: Retries due to slow responses or 5xx errors.Solution: Implement idempotency using eventId. Store processed event IDs and skip duplicates.

Next Steps

Webhook Setup

Configure webhook endpoints

HTTP Endpoints

Use webhookMode in payment requests

Get Transaction

Query transaction status for reconciliation

Data Types

Complete data type reference