Create a webhook endpoint
Choose the events you need
Subscribe to the specific event types your integration depends on, such as
payment.completed or refund.completed.Create the webhook
Call
POST /v1/aggregators/{{aggregator_id}}/webhooks with the URL and event list.Webhook headers
Safepay includes headers that identify the event and allow you to verify authenticity. Always read:X-SFPY-SIGNATUREfor the HMAC signatureX-SFPY-TIMESTAMPfor the event timestamp
Signature verification
Safepay signs the rawpayload body. Use the signature header and timestamp header to verify authenticity.
Compute HMAC
Compute HMAC SHA-256 using the timestamp, a period separator, and the raw payload bytes:
timestamp + '.' + payload.Use the webhook
payload object as the body argument when computing the signature.headerFormat represents the signature format Safepay uses when building the X-SFPY-SIGNATURE header. Keep it consistent with the value you receive.Retry behavior
Safepay retries failed deliveries up to 5 attempts using exponential backoff:- Attempt 1: 1 second
- Attempt 2: 2 seconds
- Attempt 3: 4 seconds
- Attempt 4: 8 seconds
- Attempt 5: 16 seconds
200 OK as soon as you persist the event to stop further retries.
Event catalog
| Event | Category | Description |
|---|---|---|
payment.created | Payments | A new payment request was created (initiated by customer). |
payment.pending_authorization | Payments | Payment is awaiting authorization (for example, Pay Later checks). |
payment.authorized | Payments | Payment has been authorized and funds are on hold. |
payment.completed | Payments | Payment has been captured or charged successfully. |
payment.settled | Payments | Payment funds have been settled to the merchant. |
payment.refunded | Payments | Payment was fully refunded. |
payment.refund_partial | Payments | Payment was partially refunded. |
payment.rejected | Payments | Payment was rejected before authorization. |
payment.failed | Payments | Payment processing failed. |
payment.reversed | Payments | Payment was reversed after completion. |
payment.voided | Payments | Payment authorization was voided. |
settlement.created | Settlements | Settlement request was created. |
settlement.processing | Settlements | Settlement is currently processing. |
settlement.completed | Settlements | Settlement completed successfully. |
settlement.failed | Settlements | Settlement failed during processing. |
settlement.on_hold | Settlements | Settlement temporarily placed on hold. |
settlement.reversed | Settlements | Settlement was reversed. |
refund.created | Refunds | Refund request was created. |
refund.completed | Refunds | Refund was successfully completed. |
refund.failed | Refunds | Refund failed during processing. |
refund.canceled | Refunds | Refund request was canceled. |