Skip to main content

What are Webhooks

Webhooks let NTX Pay send HTTPS notifications to your server whenever a relevant event happens — cash-in confirmation, cash-out failure, etc. — without you having to poll GET /api/transactions.

Available Events

EventWhen it fires
cash_inSPEI cash-in confirmed or OXXO cash-in paid at the register
cash_outSPEI cash-out settled
refund_inReceived refund (one of your cash-outs was returned)
refund_outSent refund (you refunded a cash-in)
internal_transferInternal transfer between NTX Pay accounts

Configuration

Endpoint: POST /api/webhooks-config. You provide:
  • url — HTTPS endpoint on your server
  • events — array with 1 to 5 events
  • secret — optional. If omitted, NTX Pay generates one automatically and returns it in the response.
See the Setup guide for the step-by-step.

Security — HMAC Signature

Every webhook is signed with HMAC-SHA256 using the secret. Headers sent:
HeaderContent
X-NTXPay-Signaturesha256=<hex-hmac> of the raw body
X-NTXPay-TimestampUnix timestamp of the delivery
X-NTXPay-Eventevent name (cash_in, etc.)
X-NTXPay-Deliveryunique delivery UUID (use for dedupe)
Always validate the signature before processing — without it, anyone can forge notifications.

Delivery Guarantees

  • At-least-once: you may receive the same event more than once. Use X-NTXPay-Delivery to deduplicate.
  • Retries: up to 5 attempts in exponential backoff if you respond with a non-2xx status.
  • Timeout: 10 seconds. Respond fast — process asynchronously if needed.
  • Order: events may arrive out of order under error conditions. Check createdAt in the payload.
  1. Respond 200 immediately after validating the signature and queueing the event.
  2. Deduplicate by X-NTXPay-Delivery or transaction.id.
  3. Idempotency: process confirmed cash_in for the same externalId only once.
  4. Re-query /api/transactions if in doubt about state — the webhook is an optimization, not the source of truth.
  5. HTTPS required — webhooks are only delivered to HTTPS URLs.

Next Steps

Webhook Setup

Configure the endpoint on your account

Implementation

HMAC validation examples in Node, Python and PHP