Webhooks

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

RuleRequirement
Schemehttps only.
PortThe default https port. https://example.com:8443/ is rejected.
HostA public hostname with at least one dot. IP addresses are rejected, public ones included.
InternalNo localhost, and no internal-only suffixes (e.g .local, .internal, .lan, etc)
UserinfoNo username or password in the URL.
DeniedNot on Decal's deny list.
LengthUp to 512 characters.

Valid:

https://yoursite.com/webhooks/decal
https://api.yoursite.com/hooks/decal?source=checkout

Rejected:

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 brokenMessage
Not an http(s) URLInvalid URL
Not httpsWebhook URLs must use https
Credentials in the URLWebhook URLs must not contain a username or password
Non-default portWebhook URLs must use the default https port
IP addressWebhook URLs must use a hostname, not an IP address
Internal hostnameWebhook URLs must use a public hostname
Denied hostWebhook 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 3xx response counts as a failed attempt and is retried like any other non-2xx, but Decal never requests the Location you 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.