The Stripe webhook.
const url = 'https://api.opdns.io/v1/webhooks/stripe';const options = { method: 'POST', headers: {'Stripe-Signature': 'example', 'Content-Type': 'application/json'}, body: '{"id":"evt_1SXa1b2c3d4e5f6g7h8i9j0k","object":"event","type":"customer.subscription.updated","created":1791460800,"livemode":false,"api_version":"2026-09-30.endive","data":{"object":{"id":"sub_1SXa1b2c3d4e5f6g7h8i9j0k","object":"subscription","status":"active","customer":"cus_T7a1b2c3d4e5f6"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.opdns.io/v1/webhooks/stripe \ --header 'Content-Type: application/json' \ --header 'Stripe-Signature: example' \ --data '{ "id": "evt_1SXa1b2c3d4e5f6g7h8i9j0k", "object": "event", "type": "customer.subscription.updated", "created": 1791460800, "livemode": false, "api_version": "2026-09-30.endive", "data": { "object": { "id": "sub_1SXa1b2c3d4e5f6g7h8i9j0k", "object": "subscription", "status": "active", "customer": "cus_T7a1b2c3d4e5f6" } } }'The Stripe webhook endpoint. Each request carries the
Stripe-Signature header (t=<unix time>,v1=<hex HMAC-SHA256 of "t.body" with the endpoint's signing secret>), within 5 minutes. Anything else gets 400. The API records events by
their id, so an event that Stripe delivers again changes nothing. The API
acknowledges and ignores an event of the other mode (live or test) than the key
of the deployment. On checkout.session.completed,
customer.subscription.created|updated|deleted|paused|resumed,
invoice.paid, invoice.payment_failed, refund.created, refund.updated and
refund.failed, the control plane reads the subscription (or refund) back from
Stripe and applies what it says now. It sets the plan of the organization (from
the metadata opdns_plan of the price), free when the subscription ended, and
the dunning grace while the subscription is past due. The API acknowledges and
ignores other events. A 5xx or 429 answer makes Stripe deliver again. Public
(the signature is the authentication) and rate limited per client IP. Answers
404 while billing is off.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”A Stripe event (https://docs.stripe.com/api/events/object).
object
object
Example
{ "id": "evt_1SXa1b2c3d4e5f6g7h8i9j0k", "object": "event", "type": "customer.subscription.updated", "created": 1791460800, "livemode": false, "api_version": "2026-09-30.endive", "data": { "object": { "id": "sub_1SXa1b2c3d4e5f6g7h8i9j0k", "object": "subscription", "status": "active", "customer": "cus_T7a1b2c3d4e5f6" } }}Responses
Section titled “Responses”Received (applied, a duplicate, or ignored).
object
Example
{ "result": "applied"}Malformed request.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "The JSON in the request is not valid (unexpected end of JSON input). Correct the JSON and try again.", "request_id": "5f2c9a0e7b1d4c38"}Not found (also for resources of another organization).
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/not_found", "title": "Not Found", "status": 404, "code": "not_found", "detail": "We did not find that. The link is wrong, or the item no longer exists.", "request_id": "5f2c9a0e7b1d4c38"}Malformed request.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "The JSON in the request is not valid (unexpected end of JSON input). Correct the JSON and try again.", "request_id": "5f2c9a0e7b1d4c38"}Rate limited (rate_limited). For an API token, the organization used all of the rate of its plan until RateLimit-Reset.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/rate_limited", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "You sent too many requests in a short time. Wait a moment, then try again.", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 6}Headers
Section titled “Headers”On every response to an API token: the rate of the plan of the organization, in requests per one-minute window (api_requests_per_minute).
On every response to an API token: the requests left to the organization in the current window.
On every response to an API token: the seconds until the current window ends and the count resets.
On every response to an API token: the quota policy, <limit>;w=60.
The payment provider (Stripe) failed or did not answer.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/billing_provider_error", "title": "Bad Gateway", "status": 502, "code": "billing_provider_error", "detail": "Our payment provider does not respond now. The problem is not with your account. Try again in a minute."}