API REFERENCE
...
Instant payment
Cancel a payment initiation
1 min
{ "name" "cancel", "method" "post", "url" "https //api sandbox klavi ai/payment/customer/v1/instant/payments/{id}/cancel", "description" "cancel a payment initiation", "tab" "examples", "examples" { "languages" \[ { "id" "zfcwiikuyaefto91irlvu", "language" "curl", "code" "curl location globoff 'https //api sandbox klavi ai/instant/payment/customer/v1/payments/{id}/cancel/{id}' \\\\\n header 'accept application/json' \\\\\n header 'content type application/json' \\\\\n data '{\n \\"cancelledby\\" \\"string\\",\n \\"identifiertype\\" \\"string\\"\n}'", "customlabel" "" }, { "id" "vtopud j ygbomiq7hxta", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //api sandbox klavi ai/payment/customer/v1/instant/payments/{id}/cancel/{id}',\n 'headers' {\n 'accept' 'application/json',\n 'content type' 'application/json'\n },\n body json stringify({\n \\"cancelledby\\" \\"string\\",\n \\"identifiertype\\" \\"string\\"\n })\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "customlabel" "" }, { "id" "iby q342yljalhfdi6kax", "language" "javascript", "code" "var myheaders = new headers();\nmyheaders append(\\"accept\\", \\"application/json\\");\nmyheaders append(\\"content type\\", \\"application/json\\");\n\nvar raw = json stringify({\n \\"cancelledby\\" \\"string\\",\n \\"identifiertype\\" \\"string\\"\n});\n\nvar requestoptions = {\n method 'post',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(\\"https //api sandbox klavi ai/payment/customer/v1/instant/payments/{id}/cancel/{id}\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "v7juth35 g4gkmirlon y", "language" "python", "code" "import requests\nimport json\n\nurl = \\"https //api sandbox klavi ai/payment/customer/v1/instant/payments/{id}/cancel/{id}\\"\n\npayload = json dumps({\n \\"cancelledby\\" \\"string\\",\n \\"identifiertype\\" \\"string\\"\n})\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", "customlabel" "" }, { "id" "fcdp3v8cjcg7ijepn2cep", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"json\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/payment/customer/v1/instant/payments/{id}/cancel/{id}\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http post new(url)\nrequest\[\\"accept\\"] = \\"application/json\\"\nrequest\[\\"content type\\"] = \\"application/json\\"\nrequest body = json dump({\n \\"cancelledby\\" \\"string\\",\n \\"identifiertype\\" \\"string\\"\n})\n\nresponse = https request(request)\nputs response read body\n", "customlabel" "" } ], "selectedlanguageid" "fcdp3v8cjcg7ijepn2cep" }, "results" { "languages" \[ { "id" "td0b0qhif fzjlrbmyrni", "language" "200", "customlabel" "", "code" "" } ], "selectedlanguageid" "td0b0qhif fzjlrbmyrni" }, "request" { "pathparameters" \[ { "name" "id", "kind" "required", "type" "string", "description" "payment initiation order id, it will be returned when post /payments is called", "" "payment initiation order id, it will be returned when post /payments is called" } ], "queryparameters" \[], "headerparameters" \[ { "name" "authorization", "kind" "required", "type" "string", "description" "jwt bearer token", "children" \[] } ], "bodydataparameters" \[ { "name" "cancelledby", "kind" "required", "type" "string", "description" "the cpf of the user that wanted to cancel", "children" \[] }, { "name" "identifiertype", "kind" "required", "type" "string", "description" "type of the user identification document cnpj or cpf", "" "type of the user identification document cnpj or cpf" } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "response" \[] } https //docs klavipay ai/docs/api reference/customer/payments/cancel payment#code 200