Skip to main content
Webhooks allow your application to be notified automatically when changes happen in payments and cashouts.

How it works

When you create a payment or cashout with callbackUrl, Safefy sends an HTTP POST request to that URL whenever status reaches a relevant state. For full domain-specific payloads, see:

Payment events


Cashout events


Sent headers


Signature

  • For payment.* events, the secret is paymentId.
  • For cashout.* events, the secret is payoutId.
Always validate the signature before processing the webhook.

Retries

If your endpoint does not return 2xx, Safefy retries:
  1. Attempt 1 (immediate)
  2. Attempt 2 after ~2 seconds
  3. Attempt 3 after ~4 seconds
Recommendation: acknowledge quickly (200 OK) and process asynchronously.

Idempotency

Because retries can happen, your webhook processing must be idempotent.
  • Recommended key: id (delivery id) or data.id + type
  • Ignore already-processed events

Quick example


Payment status flow

Understand the transaction lifecycle and when each webhook is fired:

Best practices

Respond quickly

Return 200 OK immediately and process the webhook asynchronously.

Be idempotent

Use the webhook id to avoid processing the same event twice.

Validate the signature

Always verify X-Safefy-Signature before trusting the payload.

Use HTTPS

Configure your callbackUrl with HTTPS in production.