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

{
  "id": "NHa90SMcCP-W0srkPEdyZ",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/webhooks/braintree/{siteId}/{accountId}",
    "servers": [],
    "name": "Handle Braintree webhook events",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "siteId",
          "type": "string",
          "description": ""
        },
        {
          "kind": "required",
          "name": "accountId",
          "type": "string",
          "description": ""
        }
      ],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "f2z_RAHsfNanQayDH7kEu",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /webhooks/braintree/{siteId}/{accountId} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "Y5PimHNlDUbQCIjjHyNxc",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/webhooks/braintree/{siteId}/{accountId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "8loz_sVwgQCFlWT0aLqi_",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/webhooks/braintree/{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\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "jKE1XRkkiufP2cJbf9MHq",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/webhooks/braintree/{siteId}/{accountId}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "f2z_RAHsfNanQayDH7kEu"
    },
    "results": {
      "languages": [
        {
          "id": "ZjXZdhoqEQpOAby21h8aR",
          "language": "201",
          "code": ""
        },
        {
          "id": "n-QopH3ZSTF6A6YEIBS9R",
          "language": "401",
          "code": "// Unauthorized\n"
        }
      ],
      "selectedLanguageId": "ZjXZdhoqEQpOAby21h8aR"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}