# Update URL and events
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://new-url.yoursite.com/webhooks",
"events": ["checkout.completed", "refund.completed"]
}'
# Disable endpoint
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'
const endpointId = 'wh_abc123';
// Add new events
const response = await fetch(
`https://api.swiftpay.cx/api/webhooks/${endpointId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
events: [
'checkout.completed',
'checkout.failed',
'refund.completed',
'refund.failed',
'withdrawal.completed'
]
})
}
);
const updated = await response.json();
console.log('Updated events:', updated.data.events);
import requests
endpoint_id = 'wh_abc123'
# Disable endpoint
response = requests.put(
f'https://api.swiftpay.cx/api/webhooks/{endpoint_id}',
headers={
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
json={'isActive': False}
)
updated = response.json()
print(f"Endpoint active: {updated['data']['isActive']}")
{
"success": true,
"data": {
"id": "wh_abc123",
"url": "https://new-url.yoursite.com/webhooks",
"events": [
"checkout.completed",
"refund.completed"
],
"isActive": true,
"description": "Production webhook handler",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:00:00Z"
}
}
{
"success": false,
"error": {
"type": "validation_error",
"message": "URL must be HTTPS",
"requestId": "req_abc123"
}
}
{
"success": false,
"error": {
"type": "not_found",
"message": "Webhook endpoint not found",
"requestId": "req_abc123"
}
}
Webhooks
Update Webhook Endpoint
Update an existing webhook endpoint’s configuration
PUT
/
api
/
webhooks
/
:id
# Update URL and events
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://new-url.yoursite.com/webhooks",
"events": ["checkout.completed", "refund.completed"]
}'
# Disable endpoint
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'
const endpointId = 'wh_abc123';
// Add new events
const response = await fetch(
`https://api.swiftpay.cx/api/webhooks/${endpointId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
events: [
'checkout.completed',
'checkout.failed',
'refund.completed',
'refund.failed',
'withdrawal.completed'
]
})
}
);
const updated = await response.json();
console.log('Updated events:', updated.data.events);
import requests
endpoint_id = 'wh_abc123'
# Disable endpoint
response = requests.put(
f'https://api.swiftpay.cx/api/webhooks/{endpoint_id}',
headers={
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
json={'isActive': False}
)
updated = response.json()
print(f"Endpoint active: {updated['data']['isActive']}")
{
"success": true,
"data": {
"id": "wh_abc123",
"url": "https://new-url.yoursite.com/webhooks",
"events": [
"checkout.completed",
"refund.completed"
],
"isActive": true,
"description": "Production webhook handler",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:00:00Z"
}
}
{
"success": false,
"error": {
"type": "validation_error",
"message": "URL must be HTTPS",
"requestId": "req_abc123"
}
}
{
"success": false,
"error": {
"type": "not_found",
"message": "Webhook endpoint not found",
"requestId": "req_abc123"
}
}
Update Webhook Endpoint
Updates the configuration of an existing webhook endpoint.Request
Bearer token with your API key
The unique identifier of the webhook endpoint
Updated HTTPS URL for webhook delivery
Updated array of event types to subscribe to
Enable or disable the endpoint
Updated description
Response
Whether the request was successful
Updated webhook endpoint object
# Update URL and events
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://new-url.yoursite.com/webhooks",
"events": ["checkout.completed", "refund.completed"]
}'
# Disable endpoint
curl -X PUT https://api.swiftpay.cx/api/webhooks/wh_abc123 \
-H "Authorization: Bearer mp_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'
const endpointId = 'wh_abc123';
// Add new events
const response = await fetch(
`https://api.swiftpay.cx/api/webhooks/${endpointId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
events: [
'checkout.completed',
'checkout.failed',
'refund.completed',
'refund.failed',
'withdrawal.completed'
]
})
}
);
const updated = await response.json();
console.log('Updated events:', updated.data.events);
import requests
endpoint_id = 'wh_abc123'
# Disable endpoint
response = requests.put(
f'https://api.swiftpay.cx/api/webhooks/{endpoint_id}',
headers={
'Authorization': 'Bearer mp_live_your_api_key',
'Content-Type': 'application/json'
},
json={'isActive': False}
)
updated = response.json()
print(f"Endpoint active: {updated['data']['isActive']}")
{
"success": true,
"data": {
"id": "wh_abc123",
"url": "https://new-url.yoursite.com/webhooks",
"events": [
"checkout.completed",
"refund.completed"
],
"isActive": true,
"description": "Production webhook handler",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:00:00Z"
}
}
{
"success": false,
"error": {
"type": "validation_error",
"message": "URL must be HTTPS",
"requestId": "req_abc123"
}
}
{
"success": false,
"error": {
"type": "not_found",
"message": "Webhook endpoint not found",
"requestId": "req_abc123"
}
}
Common Updates
Disable an Endpoint
{ "isActive": false }
Add Events
{
"events": [
"checkout.completed",
"checkout.failed",
"refund.completed",
"refund.failed"
]
}
Subscribe to All Events
{
"events": ["*"]
}
Updating an endpoint does not change the signing secret. The original secret
remains valid.
⌘I