Skip to main content

What Are Webhooks

Webhooks let NTX Pay send HTTPS notifications to your server whenever a relevant event occurs — cash-in confirmation, cash-out failure, return — without you having to poll.

Webhook Types

When registering a webhook via POST /api/webhooks-config, you choose which event type that URL receives:
Each webhook subscribes to exactly one type. To receive multiple types on separate URLs, create one webhook per type — or use all to centralize everything on one URL and route by the payload’s event field.

Payload

Every webhook delivers the same payload format:
string
Event type: transaction.cash_in.settled, transaction.cash_in.rejected, transaction.cash_in.returned, transaction.cash_out.settled, transaction.cash_out.rejected, transaction.cash_out.returned, or the .pending variants. Use this field to route processing.
string
Transaction identifier. Correlate it with the id returned when the charge/transfer was created.
integer
Amount in MXN centavos.
string
LIQUIDATED (settled), REJECTED (rejected), RETURNED (returned), EXPIRED (expired unpaid), or PENDING (processing).
string
Destination and source CLABEs of the transfer. May be null depending on the flow.
string
Name of the payer (cash-in), when provided by the network. May be null.
string
SPEI numeric reference and receipt, when available.
string
ISO 8601 timestamp of the event.

Headers

Always validate the signature before processing — without it, anyone can forge notifications. See Implementation.

Delivery Guarantees

  • At-least-once: you may receive the same event more than once. Deduplicate by x-event-id.
  • Retries: up to 5 attempts with exponential backoff (starting at ~5s) if you respond with a non-2xx status.
  • Timeout: 10 seconds. Respond fast — process asynchronously if needed.
  • Ordering: events may arrive out of order under error conditions. Check occurredAt in the payload.

Best Practices

  1. Respond 200 immediately after validating the signature and enqueueing the event.
  2. Deduplicate by x-event-id.
  3. Route by the event field — do not assume a URL receives a single type (especially with all).
  4. Handle status explicitly — implement all four states (LIQUIDATED, REJECTED, RETURNED, PENDING).
  5. HTTPS required — webhooks are only sent to URLs with the HTTPS protocol.

Next Steps

Setup

Register the URL on your account and trigger a test webhook

Implementation

HMAC validation examples in Node.js, Python, Java, and Go