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 payins, payouts, and conversions 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.
- The list of events you want to subscribe to.
- The environment (
sandboxorlive) this endpoint applies to.
Creating a Webhook Endpoint
To create a webhook endpoint:- Open the KryptaPay Dashboard.
- Navigate to Developers → Webhooks.
- Click Create Endpoint.
- Enter your HTTPS endpoint URL.
- Select the events you want to receive.
- Choose the environment —
sandboxorlive. - Save the endpoint.
whsec_...) is generated by KryptaPay and displayed once, immediately after creation. It is not user-provided and cannot be changed — if it’s lost, delete the endpoint and create a new one.
Webhook endpoints are strongly recommended to use HTTPS. Plaintext HTTP is currently accepted by the API but is not recommended: the payload and signature travel in clear text over the network.
An endpoint only receives events from transactions in the same environment. A
sandbox endpoint never receives live events, and vice versa. This mirrors the sandbox/live isolation of your API keys.Webhook Request
KryptaPay sends events using HTTP POST requests. Example:Authenticating Webhooks
Every webhook request contains a signature in the:- Algorithm: HMAC SHA-256
- Secret: The endpoint’s signing secret (
whsec_...), shown once when the endpoint was created. - Payload: The raw HTTP request body, exactly as sent (a hex digest of
HMAC-SHA256(secret, raw_body)).
sha256= prefix to strip.
The event type and event ID are also available directly as headers (X-KryptaPay-Event, X-KryptaPay-Event-Id), so you don’t need to parse the body just to route the event.
Verifying the Signature
Your application must verify the signature before processing the event.Example (Node.js)
Supported Events
There is no intermediate “processing” event for payins or payouts today — you’ll receive
*_CREATED at creation, then a terminal *_RECEIVED/*_COMPLETED/*_FAILED event once the transaction settles.Event payload fields
Thedata object’s fields depend on the event type:
amount/from_amount/to_amount are decimal strings (e.g. "10000" or "150.50"), not minor units.
Handling Webhook Events
After verifying the signature:- Check
event_type(or theX-KryptaPay-Eventheader) to route the event. - Retrieve the transaction via
data.transaction_idordata.referenceif you need more detail than the payload carries. - Update your internal records.
- Return a
2xxresponse.
Response Requirements
Your webhook endpoint must respond quickly and with a2xx status code.
Successful response:
2xx status, or doesn’t respond in time, KryptaPay will retry the delivery.
Retry Policy
Delivery is retried on any non-2xx response, a timeout, or a network error, using this schedule:
After the 6th failed attempt (roughly 9 hours after the first), delivery is marked as given up and no further retries are made. You can review recent delivery attempts (status, response code, timestamps) for each endpoint from the Dashboard.
Your webhook handler should therefore be:
- Idempotent — use
event_idto detect and skip events you’ve already processed, since retries (and rare duplicate deliveries) resend the sameevent_id. - Fast — do the minimum synchronously, offload heavier work to a background job.
- Safe to execute multiple times.
Best Practices
- Always verify
X-KryptaPay-Signatureusing the raw request body. - Store processed
event_ids to prevent double-processing on retries. - Return a
2xxstatus within 10 seconds of receiving the event. - Process heavy tasks asynchronously, after acknowledging the webhook.
- Use HTTPS endpoints only.
- Log
event_idandevent_typefor debugging. - Do not expose your webhook secret client-side or commit it to source control.
Next Steps
Verification and Compliance
Learn how KryptaPay uses KYB and KYC verification to provide secure, transparent, and trusted payment services.
