Skip to content

Update a Webhook

Replaces the URL and subscribed events of an existing webhook. Both fields are required, so a partial update is not possible: send the full set of events you want the webhook subscribed to, not just the ones you are adding.

Required scope (OAuth only): update-webhook

Parameters

ParameterTypeDescription
urlstring requiredThe HTTPS URL notifications are delivered to. Maximum 255 characters.
enabled_eventsarray requiredThe complete set of events to subscribe to. At least one, each one of transaction.paid, transaction.failed, transaction.refunded, withdrawal.created.

Returns

Returns the updated Webhook object.

Request

Endpoint: https://youcanpay.com/api/v2/webhooks/{webhook_id}Method: PUT

bash
$ curl --location -g --request PUT 'https://youcanpay.com/api/v2/webhooks/9b1f2c34-5d6e-4a7b-8c9d-0e1f2a3b4c5d' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  -u 'YOUR_PRIVATE_KEY:' \
  --data '{
    "url": "https://example.com/webhooks/youcan-pay-v2",
    "enabled_events": ["transaction.paid", "transaction.failed", "withdrawal.created"]
  }'

Response

json
{
  "object": "v2.webhook",
  "id": "9b1f2c34-5d6e-4a7b-8c9d-0e1f2a3b4c5d",
  "url": "https://example.com/webhooks/youcan-pay-v2",
  "is_live_mode": true,
  "enabled_events": "[\"transaction.paid\",\"transaction.failed\",\"withdrawal.created\"]",
  "created_at": "2026-09-09 11:04:22"
}

Errors

StatusDescription
404No webhook with that identifier exists on this account.
422The URL is missing or not a valid URL, or enabled_events is empty or contains an unknown event.