# Receive a Stripe event. Called by Stripe, not by clients

> Page: https://docs.plotwork.dev/api/post-billing-webhook. Index of every page: https://docs.plotwork.dev/llms.txt

Called by Stripe, not by clients.

`POST /billing/webhook`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Receive a Stripe event. Called by Stripe, not by clients. |
| What does it take? | A JSON body of type `object`. |
| What does it return? | Status 200 with a body of type [`WebhookAck`](https://docs.plotwork.dev/api/schemas.md#webhookack). |
| What can go wrong? | `400` the stripe-signature header is missing; `401` the signature is not valid; `413` the body is larger than the cap; `429` too many requests; `500` the event could not be handled; stripe will send it again; `503` billing is not set up on this server. Every failure uses the one error envelope. |

## What it does

Called by Stripe, not by clients. The body is a Stripe event, authenticated only by the signature in the `Stripe-Signature` header, checked against the exact bytes received. An event that is not about a Plotwork subscription is acknowledged and ignored; an event handled before is acknowledged as a duplicate; a handler that fails answers 500 so that Stripe sends the event again.

## Header parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `stripe-signature` | `string` | yes | The signature Stripe computes over the timestamp and the exact request body with this endpoint's signing secret. |

## Request body

The body has the type `object`.

| Field | Type | Required | Description |
|---|---|---|---|

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The event was received. | [`WebhookAck`](https://docs.plotwork.dev/api/schemas.md#webhookack) |
| 400 | The Stripe-Signature header is missing. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | The signature is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 413 | The body is larger than the cap. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 500 | The event could not be handled; Stripe will send it again. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Billing is not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`WebhookAck`](https://docs.plotwork.dev/api/schemas.md#webhookack).

| Field | Type | Required | Description |
|---|---|---|---|
| `received` | `true` | yes |  |
| `outcome` | `"handled" \| "duplicate" \| "ignored"` | yes | `handled` when the event changed or confirmed an account, `duplicate` when it had been handled before, `ignored` when it is not about a Plotwork subscription. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
