Webhook Event Types
SwiftPay sends webhooks for various events in your account. Each event follows a standard envelope structure.Webhook Structure
Every webhook request sent by SwiftPay has the following structure:| Field | Type | Description |
|---|---|---|
id | string | Unique event identifier (e.g., evt_abc123) |
type | string | The type of event (e.g., checkout.succeeded) |
created | string | ISO 8601 timestamp of when the event occurred |
data | object | Event-specific payload (see below for types) |
Expected Response
Your server should return a 2xx HTTP status code (e.g.,200 OK, 201 Created, 204 No Content) to acknowledge receipt of the webhook.
- Timeouts: SwiftPay waits up to 30 seconds for a response.
- Retries: If your server returns any other status code (e.g.,
4xx,5xx) or the request times out, SwiftPay will retry the delivery according to the retry schedule. - Body: The response body is ignored, but we recommend returning a short string like
OK.
Headers
Each request includes security headers for verification:| Header | Description |
|---|---|
X-Webhook-Signature | HMAC SHA-256 signature for verification. Format: t={timestamp},v1={signature} |
User-Agent | SwiftPay-Webhooks/1.0 |
Checkout Events
checkout.succeeded
Occurs when a checkout session is successfully completed and payment is received.
Payload Fields
| Field | Type | Description |
|---|---|---|
sessionId | string | Unique checkout session identifier |
amount | integer | Total amount in cents |
amountInDecimals | string | Total amount formatted as decimal (e.g. “29.99”) |
currency | string | Three-letter ISO currency code |
customerEmail | string | Email address of the customer |
customerName | string | Full name of the customer |
timestamp | string | ISO 8601 timestamp of completion |
shipping | object | Shipping address details (if collected) |
checkout.failed
Occurs when a checkout session fails (e.g., payment declined).
Payload Fields
| Field | Type | Description |
|---|---|---|
sessionId | string | Unique checkout session identifier |
amount | integer | Total amount in cents |
amountInDecimals | string | Total amount formatted as decimal (e.g. “29.99”) |
currency | string | Three-letter ISO currency code |
customerEmail | string | Email address of the customer |
errorMessage | string | Reason for the payment failure |
failedAt | string | ISO 8601 timestamp of failure |
Refund Events
refund.completed
Occurs when a refund is successfully processed.
Payload Fields
| Field | Type | Description |
|---|---|---|
refundId | string | Unique refund identifier |
sessionId | string | Original checkout session identifier |
amount | integer | Refund amount in cents |
amountInDecimals | string | Refund amount formatted as decimal (e.g. “29.99”) |
currency | string | Three-letter ISO currency code |
completedAt | string | ISO 8601 timestamp of completion |
refund.failed
Occurs when a refund attempt fails.
Payload Fields
| Field | Type | Description |
|---|---|---|
refundId | string | Unique refund identifier |
sessionId | string | Original checkout session identifier |
amount | integer | Refund amount in cents |
amountInDecimals | string | Refund amount formatted as decimal (e.g. “29.99”) |
currency | string | Three-letter ISO currency code |
errorMessage | string | Reason for the refund failure |
failedAt | string | ISO 8601 timestamp of failure |
Withdrawal Events
withdrawal.paid
Occurs when a withdrawal has been successfully paid out.
Payload Fields
| Field | Type | Description |
|---|---|---|
withdrawalId | string | Unique withdrawal identifier |
amount | integer | Withdrawal amount in cents |
amountInDecimals | string | Withdrawal amount formatted as decimal (e.g. “500.00”) |
currency | string | Three-letter ISO currency code |
destinationType | string | Type of destination (e.g. bank_account, crypto) |
completedAt | string | ISO 8601 timestamp of completion |
withdrawal.failed
Occurs when a withdrawal attempt fails.
Payload Fields
| Field | Type | Description |
|---|---|---|
withdrawalId | string | Unique withdrawal identifier |
amount | integer | Withdrawal amount in cents |
amountInDecimals | string | Withdrawal amount formatted as decimal (e.g. “500.00”) |
currency | string | Three-letter ISO currency code |
errorMessage | string | Reason for the withdrawal failure |
failedAt | string | ISO 8601 timestamp of failure |