---
title: Cancel Booking
slug: cancel-booking
docTags: 
createdAt: 2024-01-20T05:38:30.461Z
---

:::ApiMethodV2
```json
{
  "name": "Cancel Booking",
  "method": "DELETE",
  "url": "https://api.paydocker.com/{version}/booking/{partnerid}/{randomkey}",
  "description": "This API allow to Cancel a previous created booking in your PayDocker account",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "MQ0bWfSDgKd5W06LdF55Z",
        "language": "json",
        "code": "{\n    \"share_secret\": \"ixMAgUHdaVK3ZzCuJBCZaASDVDQCKY4p3GnZl4wstmvXAL1avp2VOa2QWvNMwfOnvT0x0n6WbAuDNMaTbEKHMduj8vvASCr5fpKMF9rDjp5sY63EVYTcPNHNS2CrCX9SbmUdlZFjwNFsKU2bISQ8MW\",\n    \"booking_event\": \"cancel\",\n    \"source_id\": \"PDR7\",\n    \"booking_id\": \"API-BK58\"\n}",
        "customLabel": ""
      },
      {
        "id": "gbhm77grJTs6aIrhItjq5",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'DELETE',\n   'url': 'https://api.paydocker.com/{version}/booking/{partnerid}/{randomkey}/cancel',\n   'headers': {\n      'Accept': 'application/json',\n      'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({\n    \"share_secret\": \"ixMAgUHdaVK3ZzCuJBCZaASDVDQCKY4p3GnZl4wstmvXAL1avp2VOa2QWvNMwfOnvT0x0n6WbAuDNMaTbEKHMduj8vvASCr5fpKMF9rDjp5sY63EVYTcPNHNS2CrCX9SbmUdlZFjwNFsKU2bISQ8MW\",\n    \"booking_event\": \"cancel\",\n    \"source_id\": \"PDR7\",\n    \"booking_id\": \"API-BK58\"\n})\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "V3GCZDv2C90POYfAs6meC",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n    \"share_secret\": \"ixMAgUHdaVK3ZzCuJBCZaASDVDQCKY4p3GnZl4wstmvXAL1avp2VOa2QWvNMwfOnvT0x0n6WbAuDNMaTbEKHMduj8vvASCr5fpKMF9rDjp5sY63EVYTcPNHNS2CrCX9SbmUdlZFjwNFsKU2bISQ8MW\",\n    \"booking_event\": \"cancel\",\n    \"source_id\": \"PDR7\",\n    \"booking_id\": \"API-BK58\"\n});\n\nvar requestOptions = {\n   method: 'DELETE',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.paydocker.com/{version}/booking/{partnerid}/{randomkey}/cancel\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "vITI1REwoOX-NVrxgNLtQ",
        "language": "curl",
        "code": "curl --location --globoff --request DELETE 'https://api.paydocker.com/{version}/booking/{partnerid}/{randomkey}/cancel' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"share_secret\":\"string\",\"booking_event\":\"string\",\"source_id\":\"string\",\"booking_id\":\"string\"}'",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "MQ0bWfSDgKd5W06LdF55Z"
  },
  "results": {
    "languages": [
      {
        "id": "ZniEy85b7Bx38yO7MPQf0",
        "language": "200",
        "customLabel": "",
        "code": "{\n  \"success\": \"true\",\n  \"message\": \"Booking Cancel Success\",\n  \"booking_id\": \"1705393126PDR28\"\n}"
      },
      {
        "id": "3X5_LlSkLCqy4ql7YFpv-",
        "language": "402",
        "customLabel": "",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"402\",\n    \"message\": \"Source Not Allowed\"\n  }\n}"
      },
      {
        "id": "-W6Kfwaiol1P1NXyAjoAQ",
        "language": "405",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"405\",\n    \"message\": \"Method Not Allowed\"\n  }\n}",
        "customLabel": ""
      },
      {
        "id": "-uuk3KuaiBXsqfwyCCSy6",
        "language": "403",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"403\",\n    \"message\": \"IP Not Allowed\"\n  }\n}",
        "customLabel": ""
      },
      {
        "id": "w8Fkil7hSH6rPv8qg_cTN",
        "language": "406",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"406\",\n    \"message\": \"Endpoint Bad Format\"\n  }\n}",
        "customLabel": ""
      },
      {
        "id": "kob8iFj9R-uJ0ZNVx-NDp",
        "language": "408",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"408\",\n    \"message\": \"Endpoint Suspended\"\n  }\n}",
        "customLabel": ""
      },
      {
        "id": "d21dRPvLNwf4TVYIw_IcP",
        "language": "409",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"409\",\n    \"message\": \"Event Not Allowed\"\n  }\n}",
        "customLabel": ""
      },
      {
        "id": "H3xasfy0yneHIaCw0Mr8V",
        "language": "410",
        "code": "{\n  \"success\": \"false\",\n  \"errors\": {\n    \"code\": \"410\",\n    \"message\": \"Invalid Secret Key\"\n  }\n}",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "-W6Kfwaiol1P1NXyAjoAQ"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "name": "share_secret",
        "kind": "required",
        "type": "string",
        "description": "Test mode secret keys and live mode secret keys are available in your PayDocker account under Integration menu.\n\nDon't share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.",
        "children": []
      },
      {
        "name": "booking_event",
        "kind": "required",
        "type": "string",
        "description": "Used to identify the action connected to the booking and the allowed action for this request would be \"cancel\".",
        "children": []
      },
      {
        "name": "source_id",
        "kind": "required",
        "type": "string",
        "description": "Your PayDocker Account ID assigned upon account creation (e.g. PDR1). It is case sensitive.",
        "children": []
      },
      {
        "name": "booking_id",
        "kind": "required",
        "type": "string",
        "description": "The unique identifier associated with the booking that the user is requesting a cancellation for. (e.g. 1705393126PDR28)",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

