Skip to main content

Webhooks

Webhooks allow KryptaPay to notify your application in real time when events occur on your account. Instead of continuously polling the API for transaction updates, you can register a webhook endpoint and receive notifications automatically when deposits, payouts, and other payment events change status.

How Webhooks Work

Webhook endpoints are configured from the KryptaPay Dashboard. When creating a webhook endpoint, you provide:
  • The HTTPS URL where KryptaPay will send events.
  • A webhook secret used to authenticate requests.
Once configured, KryptaPay sends an HTTP POST request to your endpoint whenever a subscribed event occurs.

Creating a Webhook Endpoint

To create a webhook endpoint:
  1. Open the KryptaPay Dashboard.
  2. Navigate to Developers → Webhooks.
  3. Click Create Endpoint.
  4. Enter your HTTPS endpoint URL.
  5. Select the events you want to receive.
  6. Generate or provide a webhook secret.
  7. Save the endpoint.
After creation, KryptaPay will use this endpoint to deliver event notifications.
Webhook endpoints must use HTTPS in production environments.

Webhook Request

KryptaPay sends events using HTTP POST requests. Example:
Request body:

Authenticating Webhooks

Every webhook request contains a signature in the:
header. The signature is generated using:
  • Algorithm: HMAC SHA-256
  • Secret: The webhook secret configured when the endpoint was created.
  • Payload: The raw HTTP request body.
The signature format is:

Verifying the Signature

Your application must verify the signature before processing the event.

Example (Node.js)

Example usage:
Always verify the signature using the raw request body. Parsing and re-serializing JSON can change the payload and cause signature verification failures.

Supported Events


Handling Webhook Events

After verifying the signature:
  1. Validate the event type.
  2. Retrieve the transaction if necessary.
  3. Update your internal records.
  4. Return a successful response.
Example:

Response Requirements

Your webhook endpoint must respond quickly. Successful response:
Example:
If your endpoint does not acknowledge the event, KryptaPay may retry the delivery.

Retry Policy

If your endpoint returns:
  • A timeout.
  • A network error.
  • A 5xx HTTP status code.
KryptaPay will retry webhook delivery. Your webhook handler should therefore be:
  • Idempotent.
  • Fast.
  • Safe to execute multiple times.

Best Practices

  • Always verify X-KryptaPay-Signature.
  • Store processed event IDs to prevent duplicates.
  • Return 200 OK after successful processing.
  • Process heavy tasks asynchronously.
  • Use HTTPS endpoints only.
  • Log webhook event IDs for debugging.
  • Do not expose your webhook secret.

Next Steps

Verification and Compliance

Learn how KryptaPay uses KYB and KYC verification to provide secure, transparent, and trusted payment services.