Skip to main content
POST
/
api
/
webhooks
curl -X POST https://api.swiftpay.cx/api/webhooks \
  -H "Authorization: Bearer mp_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yoursite.com/webhooks/swiftpay",
    "events": [
      "checkout.succeeded",
      "checkout.failed",
      "withdrawal.paid"
    ],
    "description": "Production webhook handler"
  }'
{
  "success": true,
  "data": {
    "endpoint": {
      "id": "wh_abc123",
      "url": "https://yoursite.com/webhooks/swiftpay",
      "events": [
        "checkout.succeeded",
        "checkout.failed",
        "withdrawal.paid"
      ],
      "isActive": true,
      "description": "Production webhook handler",
      "createdAt": "2024-01-15T10:30:00Z"
    },
    "secret": "whsec_1234567890abcdef"
  }
}

Create Webhook Endpoint

Creates a new webhook endpoint to receive event notifications.

Request

Authorization
string
required
Bearer token with your API key
url
string
required
The HTTPS URL where webhook events will be sent
events
array
required
Array of event types to subscribe to
description
string
Optional description for this endpoint

Response

success
boolean
Whether the request was successful
data
object
curl -X POST https://api.swiftpay.cx/api/webhooks \
  -H "Authorization: Bearer mp_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yoursite.com/webhooks/swiftpay",
    "events": [
      "checkout.succeeded",
      "checkout.failed",
      "withdrawal.paid"
    ],
    "description": "Production webhook handler"
  }'
{
  "success": true,
  "data": {
    "endpoint": {
      "id": "wh_abc123",
      "url": "https://yoursite.com/webhooks/swiftpay",
      "events": [
        "checkout.succeeded",
        "checkout.failed",
        "withdrawal.paid"
      ],
      "isActive": true,
      "description": "Production webhook handler",
      "createdAt": "2024-01-15T10:30:00Z"
    },
    "secret": "whsec_1234567890abcdef"
  }
}

Available Events

Checkout Events

EventDescription
checkout.succeededPayment was successful
checkout.failedPayment failed

Withdrawal Events

EventDescription
withdrawal.paidWithdrawal processed and paid
withdrawal.failedWithdrawal failed to process
Save the secret immediately! The webhook signing secret is only returned when creating the endpoint. Store it securely - you’ll need it to verify webhook signatures.