Webhook URLs
Requirements for the URL Decal delivers webhooks to — https, a public hostname, no redirects — and how they are enforced when you save the URL and again on every delivery.
A webhook URL is the endpoint on your server that Decal sends events to. Decal's
servers make the request, not your customer's browser, so a webhook URL has stricter rules than a
redirect URL like a successUrl.
Today you set a webhook URL with the callbackUrl field when you
create a checkout session, and Decal delivers that session's events to it.
The rules on this page apply everywhere a callbackUrl is accepted.
Requirements
| Rule | Requirement |
|---|---|
| Scheme | https only. |
| Port | The default https port. https://example.com:8443/ is rejected. |
| Host | A public hostname with at least one dot. IP addresses are rejected, public ones included. |
| Internal | No localhost, and no internal-only suffixes (e.g .local, .internal, .lan, etc) |
| Userinfo | No username or password in the URL. |
| Denied | Not on Decal's deny list. |
| Length | Up to 512 characters. |
Valid:
https://yoursite.com/webhooks/decal
https://api.yoursite.com/hooks/decal?source=checkoutRejected:
http://yoursite.com/webhooks/decal not https
https://yoursite.com:8443/webhooks non-default port
https://203.0.113.10/webhooks IP address
https://localhost/webhooks internal hostname
https://user:pass@yoursite.com/hooks credentials in the URL
https://127.0.0.1.nip.io/webhooks denied host (wildcard DNS)When you save the URL
A webhook URL that breaks a rule is rejected with a 400 VALIDATION_ERROR (see
Validation errors), and nothing is saved. The issue on the
callbackUrl field says which rule failed:
| Rule broken | Message |
|---|---|
| Not an http(s) URL | Invalid URL |
| Not https | Webhook URLs must use https |
| Credentials in the URL | Webhook URLs must not contain a username or password |
| Non-default port | Webhook URLs must use the default https port |
| IP address | Webhook URLs must use a hostname, not an IP address |
| Internal hostname | Webhook URLs must use a public hostname |
| Denied host | Webhook destination not allowed |
When Decal delivers
Every delivery checks the URL again, then checks the network:
- The hostname must resolve to public addresses only. Decal resolves your hostname itself and refuses the delivery if any address it gets back is private, loopback, link-local or otherwise non-public. The connection goes to the exact address that was checked.
- Redirects are never followed. A
3xxresponse counts as a failed attempt and is retried like any other non-2xx, but Decal never requests theLocationyou return.
A refused delivery is never sent. It is recorded as failed with the error type blocked and is not
retried. A session's callbackUrl can't be changed after creation, so use a valid URL on new
sessions. See Webhooks for retries, timeouts and headers.
Testing locally
Test mode follows the same rules as live mode, so http://localhost is rejected there too.
To receive test-mode webhooks on your machine, expose your local server through a public https tunnel such as ngrok, or inspect deliveries with webhook.site.