---
title: Handle Stripe webhook events
slug: reference/handle-stripe-webhook-events
docTags: 
createdAt: 2026-09-28T07:46:00.827Z
---

{
  "id": "3rCqn-hMGongOEmL1VJVh",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/webhooks/stripe/{siteId}/{accountId}",
    "servers": [],
    "name": "Handle Stripe webhook events",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "siteId",
          "type": "string",
          "description": ""
        },
        {
          "kind": "required",
          "name": "accountId",
          "type": "string",
          "description": ""
        }
      ],
      "headerParameters": [
        {
          "kind": "required",
          "name": "stripe-signature",
          "type": "string",
          "description": ""
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Em-YCTuVCzvwM9cDteTsy",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /webhooks/stripe/{siteId}/{accountId} \\\n     --header 'accept: application/json' \\\n     --header 'stripe-signature: string'"
        },
        {
          "id": "qYvL0_uTlQGez0uphq1XK",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"stripe-signature\", \"string\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/webhooks/stripe/{siteId}/{accountId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "pyBpGZRz_avaZWOOjQqbl",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/webhooks/stripe/{siteId}/{accountId}\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"stripe-signature\"] = \"string\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "NREBI0SoaK91YO1ZwbDrT",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/webhooks/stripe/{siteId}/{accountId}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'stripe-signature': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Em-YCTuVCzvwM9cDteTsy"
    },
    "results": {
      "languages": [
        {
          "id": "7p6dYwjj37_ZiHcu3D9_w",
          "language": "201",
          "code": ""
        },
        {
          "id": "YGVG7_R2m1jYG9P0bJW-e",
          "language": "401",
          "code": "// Unauthorized\n"
        }
      ],
      "selectedLanguageId": "7p6dYwjj37_ZiHcu3D9_w"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}