List webhook endpoints
integer
default:"1"
Page number for pagination.
Response
Get webhook endpoint
string
required
The webhook endpoint’s ID (e.g.,
we_xxx).Response
Create webhook endpoint
string
required
The URL where webhook events will be sent via HTTP POST. Must use HTTPS.
array
required
Event types to subscribe to. Use
["*"] for all events, or specify individual events like ["invoice.created", "invoice.paid"].boolean
default:"true"
Whether the endpoint is active.
string
Optional description for the endpoint.
signing_secret (returned as 201 Created).
Update webhook endpoint
string
required
The webhook endpoint’s ID.
string
The endpoint URL.
array
Event types to subscribe to.
boolean
Whether the endpoint is active.
string
Optional description.
Delete webhook endpoint
string
required
The webhook endpoint’s ID.
204 No Content.
Regenerate signing secret
string
required
The webhook endpoint’s ID.
signing_secret.
Webhook security
TRXN signs all webhook requests with HMAC-SHA256 signatures, allowing you to verify that webhooks are genuinely from TRXN.Signature header format
Every webhook request includes anX-Trxn-Signature header:
Signing secret format
Signing secrets use the formatwhsec_<64_hex_chars>:
Verifying signatures
To verify a webhook signature:- Extract the timestamp (
t) and signature (v1) from the header. - Check the timestamp is within 5 minutes of current time (prevents replay attacks).
- Compute the expected signature:
HMAC-SHA256(secret, "<timestamp>.<raw_body>"). - Compare signatures using constant-time comparison.
Use the full signing secret (including the
whsec_ prefix) as the HMAC key. This matches Stripe’s implementation.Available events
Customer events
Customer events
Product events
Product events
Price events
Price events
Invoice events
Invoice events
Subscription events
Subscription events
Subscription phase events
Subscription phase events
Wallet events
Wallet events
Crypto address events
Crypto address events
Payment claim events
Payment claim events
Crypto transaction events
Crypto transaction events
Transaction allocation events
Transaction allocation events
Webhook payload format
When an event occurs, TRXN sends a POST request to your endpoint with the following format:Subscription phase payload example
Response handling
Your endpoint should respond with a 2xx status code to indicate successful receipt. If your endpoint returns a non-2xx status code, TRXN will retry the delivery with exponential backoff (up to 11 attempts).Error handling
If your endpoint cannot be reached, TRXN will:- Connection error: Disable the endpoint to prevent further delivery attempts.
- Timeout error: Retry with exponential backoff.
- TLS error: Retry with exponential backoff.
- Non-2xx response: Retry with exponential backoff.
Event retention
TRXN retains webhook events for 30 days.Best practices
- Respond quickly: Return a 2xx response before any complex logic that could cause a timeout. Process the event asynchronously after responding.
- Handle duplicates: Webhook endpoints may occasionally receive the same event more than once. Make your event processing idempotent by tracking the
idfrom the payload. If you have already processed an event for that resource, skip it and return a 2xx response. - Handle out-of-order delivery: Events may not arrive in chronological order. Use the
timestampfield to determine the sequence of events rather than assuming arrival order. - Always verify signatures: Use the
X-Trxn-Signatureheader to verify all incoming webhooks. Reject any webhook that fails signature verification. - Use HTTPS: Always use HTTPS endpoints for security.
- Store secrets securely: Store your signing secrets in environment variables or a secrets manager, never in source code.
- Monitor failures: Check webhook events in the dashboard to monitor delivery status.
- Regenerate compromised secrets: If you suspect your signing secret has been compromised, regenerate it immediately.