Skip to content

Webhooks ​

SenteRail sends signed webhooks so your system can react to payment and workflow updates. Your receiver should verify the signature before changing order, member, accounting, or fulfilment state.

Customer Webhook Responsibilities ​

ResponsibilityWhat to do
AuthenticityVerify the SenteRail signature and timestamp before processing
IdempotencyStore event IDs and ignore duplicate deliveries
OrderingTreat events as asynchronous and reconcile when order is uncertain
AvailabilityReturn a success response only after durable persistence
RecoveryKeep a manual or automated reconciliation path for missed updates

Register a receiver ​

An active merchant account must have webhook access enabled. From your server, send POST /webhooks/endpoints to your selected, approved SenteRail API origin (the path has no /api/v1 prefix). Authenticate with either Authorization: Bearer <merchant_session_token> or X-Merchant-Api-Key: <merchant_api_key>. Supply a url and a securely generated, stored secret for that endpoint. Use that same endpoint-specific secret to verify its deliveries. Keep the secret and merchant credentials on your server.

Signature Verification ​

Confirm the delivery contract for your integration before deploying a receiver. Checked-in source currently has two incompatible shapes:

  • The Notification delivery sender emits a combined X-SenteRail-Signature: t=<unix_seconds>,v1=<signature> header (and may include v0 during rotation), without a separate X-SenteRail-Timestamp header. The internal delivery journey describes this combined shape.
  • The shared TypeScript verifier and Go webhook helper take a separate timestamp and bare hexadecimal signature. They do not parse the combined header. Their checked-in presence does not establish that a sender emits this shape for every integration.

Do not assume these paths interoperate or that either format is universally deployed. A compatible delivery/receiver contract, migration decision and regression coverage remain unresolved. Use the endpoint-specific secret and verify the unchanged raw request body under the confirmed contract; do not substitute the JSON envelope's RFC3339 timestamp or reserialize parsed JSON.

The following is recommended strict pseudocode only for a separately confirmed separate-header integration, not a description of the shipped helpers' exact parsing behavior. It requires canonical unsigned decimal Unix seconds (no sign, whitespace or leading zeros), a lowercase hex digest and raw-body bytes:

text
timestamp = header("X-SenteRail-Timestamp")
signature = header("X-SenteRail-Signature")
reject unless timestamp matches ^(?:0|[1-9][0-9]*)$ and signature is 64 lowercase hex characters
reject if timestamp is outside the receiver's accepted clock-skew window
expectedHex = HMAC_SHA256(endpointSecret, UTF8(timestamp + ".") || rawBody).lowercaseHex()
reject unless constantTimeEqual(expectedHex, signature)

The TypeScript helper uses parseInt, so a numeric prefix with a suffix can pass its timestamp parse; the Go helper trims and parses an integer and rejects nonnumeric suffixes. Both hash the parsed timestamp reserialized as a canonical number and trim/lowercase the supplied signature. The stricter example above is a receiver recommendation, not a claim that either helper enforces that shape. Keep the raw body available until verification finishes and use constant-time digest comparison.

Retry And Dedupe ​

SenteRail may retry delivery when your endpoint is unavailable or returns an error. Your webhook handler should be safe to run more than once for the same event.

Store:

  • event ID
  • event type
  • payment or workflow reference
  • received timestamp
  • processing result

Reconciliation Fallback ​

Webhooks are not a replacement for reconciliation. Network issues, provider timing, and operational incidents can create delayed or out-of-order updates. Use Reconciliation to compare SenteRail events with your own records.

Provider-Originated Updates ​

Some payment providers also send callbacks to SenteRail. Those provider-facing callbacks are not your integration endpoint. Your integration should listen for SenteRail's outbound signed events and use reconciliation when a provider event is delayed or uncertain.