Skip to main content
Afriex sends real-time webhook notifications to your configured endpoint when important resource changes happen.

How webhooks work

Afriex delivers event notifications for customer, payment method, transaction, and checkout session updates to the webhook URL you configure in your dashboard.

Set up your webhook endpoint

  1. Open the Dashboard.
  2. Go to Developer.
  3. Select the Webhook tab.
  4. Save your webhook URL.
Example webhook URLs:
  • https://your-domain.com/webhook
After you save your webhook URL, you can copy your webhook public key from the same screen.

Afriex IP addresses

Allowlist these IPs before going live. To receive webhook deliveries, your server must allow inbound traffic from the following Afriex IP addresses:Add these to your firewall allowlist. Without this, Afriex webhook requests will be blocked.

Security and signature validation

Every webhook request includes an x-webhook-signature header. You must validate this signature before processing the payload.
  • Header: x-webhook-signature
  • Algorithm: ECDSA with SHA-256
  • Key: elliptic-curve, secp384r1 (P-384). It is not an RSA key.
  • Signature format: DER-encoded, then base64-encoded
  • Signed data: the exact raw request body (string/Buffer)
  • Public key source: Developer → Webhook in the Dashboard
  • Environment note: Sandbox and production use different public keys
Always verify against the raw request body bytes. Do not verify parsed JSON, and do not re-serialize the body before you verify it.
The key is elliptic-curve, not RSA. A verifier built for RSA (for example RSA-SHA256 with PKCS#1 v1.5) rejects every delivery. Use ECDSA with the P-384 curve and SHA-256.
Libraries that expect a raw r||s (IEEE P1363) signature, such as WebCrypto and JOSE libraries, need the DER signature converted first. Node’s crypto module reads DER by default, so the sample below needs no conversion.

Response and retries

Return a success response quickly after verification and processing.
  • On success: return 200 (or another 2xx status). Afriex waits up to 15 seconds for your response before treating the attempt as failed, so aim well inside that budget and do slow work after acknowledging.
  • On verification failure: return 400 or 401
  • Retry behavior: Afriex makes up to 12 delivery attempts, the first one and then up to 11 retries, with exponential backoff starting at 30 seconds.
The wait before each retry roughly doubles:
  • 30s → 1m → 2m → 4m → 8m → 16m → 32m → about 1h → about 2h → about 4h → about 8h

Duplicates, ordering, and replays

Every webhook body carries two fields besides event and data: The signature covers the whole body, so both fields are signed. You verify the signature exactly as before. Build your handler for three cases:
  • The same event more than once. Afriex retries any delivery that doesn’t get a 2xx within 15 seconds, even if you processed it. Store the id of each event you process. When a delivery’s id is one you have, return 200 and skip it.
  • Events out of order. A retried event can arrive after a newer one, and TRANSACTION.UPDATED can arrive before TRANSACTION.CREATED. Compare the payload’s data.updatedAt with the version you have stored, and ignore anything older.
  • Replayed deliveries. A captured delivery still has a valid signature if someone sends it again. Your stored ids stop a replay, because it carries an id you’ve already processed. Retries can arrive up to about 16 hours after createdAt, so keep each id for at least a day.
Acknowledge an event once you have stored it, not once you have finished acting on it. Saving it first means a crash can’t lose it, and answering straight away keeps you well inside the 15 seconds:

Webhook event references