Skip to main content

POST /api/v1/webhooks/stripe

Creates a new webhooks resource.

This endpoint documentation is generated from the current Fastify route implementation and should be treated as the implementation-level contract for this version of the API.

Source route file: src/api/routes/external/public/webhooks/stripe/post.ts

Request Method

POST

Base URL

https://api.userdocks.local:5000

Endpoint

/api/v1/webhooks/stripe

Path Variables

No path variables.

Query Parameters

No query parameters.

HTTP Headers

VariableTypeRequiredDescription
stripe-signaturestringtrueStripe webhook signature used by stripe.webhooks.constructEvent(...).
Content-TypestringtrueUse application/json for JSON request bodies.

Request Body

No application-level schema is enforced in this route. The handler expects the raw Stripe webhook payload (request.body.raw) that matches Stripe's event JSON format.

Example payload shape:

{
"id": "evt_123",
"object": "event",
"type": "invoice.paid",
"data": {
"object": {
"id": "in_123"
}
}
}

Successful Response

Success status code(s): 200.

{
"received": true
}

Alternative success payload (host mismatch early-return branch):

{
"received": true,
"host": "api.userdocks.local:5000",
"wrongHost": true
}

Error Responses

HTTP StatusExample Error
400{"errors":[{"validation":"error","code":"[E4000]","message":"Bad Request / validation error"}]}
500{"errors":[{"validation":"error","code":"[E0000]","message":"Internal Server Error"}]}

Example

const url = `https://api.userdocks.local:5000/api/v1/webhooks/stripe`;

const response = await fetch(url, {
method: 'POST',
headers: {
'stripe-signature': 't=1735689600,v1=<signature>',
'Content-Type': 'application/json',
},
body: '{"id":"evt_123","object":"event","type":"invoice.paid","data":{"object":{"id":"in_123"}}}',
});
const data = await response.json();
console.log(response.status, data);