Receive Stripe subscription updates

Verify signed Stripe subscription events and apply account plan changes.

POST /billing/webhook

This endpoint is for Stripe. It verifies the raw request body and signature, records processed events and updates the linked account. Local test events are applied in process, not accepted from public HTTP.

Authentication

No API key is required for this route. Stripe must send a valid Stripe-Signature header for the exact raw request body.

Parameters

NameLocationTypeRequiredDetails
stripe-signatureheaderstring or nullNo

Example request

curl --fail-with-body -X POST \
  "https://polymarket.omray.dev/billing/webhook"

Responses

StatusMeaning
200Successful Response
422Validation Error

Authenticated requests can return 401 for an invalid key or 429 when a plan limit is reached. Upstream failures may return a server error; do not treat an error as an empty dataset.

OpenAPI operation schema
{
  "tags": [
    "Billing"
  ],
  "summary": "Receive signed Stripe subscription events",
  "description": "Stripe signs events with STRIPE_WEBHOOK_SECRET. Local test billing is never exposed over HTTP.",
  "operationId": "billing_webhook",
  "parameters": [
    {
      "name": "stripe-signature",
      "in": "header",
      "required": false,
      "schema": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Stripe-Signature"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Successful Response",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/WebhookResult"
          }
        }
      }
    },
    "422": {
      "description": "Validation Error",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/HTTPValidationError"
          }
        }
      }
    }
  }
}