API reference / Webhooks
Set your webhook URL
/v1/webhook-endpoint Sets or replaces this mode's webhook URL, and optionally a separate URL for withdrawal events. They can only be set here, not in the dashboard, so nobody changes them by accident; every change is emailed to your Owners and Developers.
Each webhook goes to exactly one URL: a payment's own webhook_url if it has one, else withdrawals_url for withdrawal events when set, else url (limited to events).
The URL must be public HTTPS: private and internal addresses are refused. Webhooks are signed with the signing key you create in the dashboard, and none are sent until one exists (has_signing_key).
Where each webhook goes
Every webhook goes to exactly one URL, so one event never goes to two of your URLs. Weav picks it in this order:
- The payment’s
webhook_url. A payment created with one sends all its events there: completed, failed, canceled, reversed and refunded. Yoururland itseventslist don’t apply to that payment. withdrawals_url, for withdrawal events. When it’s set,WITHDRAWAL_COMPLETEDandWITHDRAWAL_FAILEDgo there, andurlno longer gets them.url, for everything else, limited to theeventsyou chose.
| Event | Payment has a webhook_url | withdrawals_url is set | Goes to |
|---|---|---|---|
| A payment event | Yes | (doesn’t matter) | webhook_url only |
| A payment event | No | (doesn’t matter) | url, if it’s in events |
| A withdrawal event | (not a payment) | Yes | withdrawals_url only |
| A withdrawal event | (not a payment) | No | url, if it’s in events |
- Every URL follows the same rules: public HTTPS only (private and internal addresses are refused when you set it, and checked again before each delivery), signed with your signing key (see Verifying signatures), retried the same way, and shown under Developers in the dashboard with its deliveries.
- Live and test keys each set their own mode’s URLs.
- Every change to
urlorwithdrawals_urlis emailed to your account’s Owners and Developers, with the API key that made it. - In live mode, if a URL keeps failing, your Owners, Developers and technical contact get an email: when nothing has gotten through for 10 minutes, when it’s down for an hour, a reminder if it’s still down a day later, and one when it works again. If about a quarter of webhooks fail while others get through, they get one email about that too. A short blip sends nothing. Set the technical contact on the Developers page of your dashboard.
- Nothing is sent until you create a signing key in the dashboard under Developers. Until then,
has_signing_keyisfalse.
Headers
AuthorizationstringRequiredBearerplus your API key. See Authentication.
Body
JSON, with Content-Type: application/json.
urlstring (uri)RequiredRequired. A public HTTPS URL, up to 2,048 characters. Its host must resolve. Private and internal addresses (such aslocalhostor10.x) are refused.Up to 2048 characterseventsarray of stringsWhich events url gets. Leave out for all of them. Doesn't limitwithdrawals_urlor a payment'swebhook_url.One of:PAYMENT_COMPLETEDPAYMENT_FAILEDPAYMENT_CANCELLEDPAYMENT_REVERSEDPAYMENT_REFUNDEDCHECKOUT_COMPLETEDCHECKOUT_EXPIREDPAYMENT_METHOD_SAVEDPAYMENT_METHOD_FAILEDPAYMENT_METHOD_REMOVEDWITHDRAWAL_COMPLETEDWITHDRAWAL_FAILEDwithdrawals_urlstring | nullOptional. Withdrawal events go here instead of url (url stops getting them). Null removes it; leaving it out keeps it.Up to 2048 characters
Responses
200 OK
Saved (code 2000000).
What data holds
webhook_endpointobject7 fields in
webhook_endpointurlstringeventsarray of stringshealthstringOne of:UNKNOWNHEALTHYFAILINGDOWNwithdrawals_urlstring | nullWhere withdrawal events go, when not url.has_signing_keybooleanWebhooks go out only once a signing key exists. Create it in the dashboard under Developers.last_success_atstring (date-time) | nullupdated_atstring (date-time) | null
401 Unauthorized
Missing, malformed or unknown API key (code 4010000).
403 Forbidden
The key can't make this request (code 4030000): an address outside the key's IP allowlist, a live key before your live mode is on, or an account that isn't active. A live key sent from a browser is refused (code 4030001): keep live keys on your server.
422 Unprocessable Content
One or more fields are invalid (code 4220000), or the channel is off (4220101) or doesn't take the currency (4220102).