{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab","admonition"]},"type":"markdown"},"seo":{"title":"Reefpay Docs","description":"Reefpay is the groundbreaking payment gateway that lets you integrate with the future of payments.","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"cancel-an-authorized-transaction","__idx":0},"children":["Cancel an authorized transaction"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A valid API key — see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/how-tos/setup/obtain-credentials"},"children":["Obtain API credentials"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A transaction in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorized"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["captured"]}," state (before batch closure)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-confirm-the-transaction-state","__idx":2},"children":["Step 1: Confirm the transaction state"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve the transaction to verify it has not already settled."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"curl -X GET \\\n  https://api.dev.paradisegateway.net/v1/transactions/TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y \\\n  -H \"APIKEY: YOUR-API-KEY\"\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transaction_state"]}," field. If it is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorized"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["captured"]},", you can cancel. If it is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["settled"]},", you must ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/how-tos/manage-transactions/refund-settled-auth"},"children":["refund instead"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-cancel-the-transaction","__idx":3},"children":["Step 2: Cancel the transaction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/transactions/{id}/cancel"]}," with the cancel type and amount."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"card-cancel","__idx":4},"children":["Card cancel"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"curl","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"curl -X POST \\\n  https://api.dev.paradisegateway.net/v1/transactions/TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y/cancel \\\n  -H \"Content-Type: application/json\" \\\n  -H \"APIKEY: YOUR-API-KEY\" \\\n  -d '{\n    \"type\": \"cancel\",\n    \"amount\": 15000\n  }'\n","lang":"shell"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import requests\n\ntransaction_id = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\"\nresp = requests.post(\n    f\"https://api.dev.paradisegateway.net/v1/transactions/{transaction_id}/cancel\",\n    headers={\"Content-Type\": \"application/json\", \"APIKEY\": \"YOUR-API-KEY\"},\n    json={\"type\": \"cancel\", \"amount\": 15000},\n)\nprint(resp.json())\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JavaScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const transactionId = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\";\nconst resp = await fetch(\n  `https://api.dev.paradisegateway.net/v1/transactions/${transactionId}/cancel`,\n  {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application/json\",\n      \"APIKEY\": \"YOUR-API-KEY\",\n    },\n    body: JSON.stringify({ type: \"cancel\", amount: 15000 }),\n  }\n);\nconsole.log(await resp.json());\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"C#","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"var transactionId = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\";\nvar payload = new { type = \"cancel\", amount = 15000 };\nvar resp = await client.PostAsJsonAsync(\n    $\"https://api.dev.paradisegateway.net/v1/transactions/{transactionId}/cancel\",\n    payload);\nConsole.WriteLine(await resp.Content.ReadAsStringAsync());\n","lang":"csharp"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"String transactionId = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\";\nString body = \"\"\"\n    {\"type\": \"cancel\", \"amount\": 15000}\n    \"\"\";\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\n        \"https://api.dev.paradisegateway.net/v1/transactions/\"\n        + transactionId + \"/cancel\"))\n    .header(\"Content-Type\", \"application/json\")\n    .header(\"APIKEY\", \"YOUR-API-KEY\")\n    .POST(HttpRequest.BodyPublishers.ofString(body)).build();\nHttpResponse<String> resp = client.send(request,\n    HttpResponse.BodyHandlers.ofString());\nSystem.out.println(resp.body());\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"transactionID := \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\"\npayload := strings.NewReader(`{\"type\": \"cancel\", \"amount\": 15000}`)\nreq, _ := http.NewRequest(\"POST\",\n    \"https://api.dev.paradisegateway.net/v1/transactions/\"+transactionID+\"/cancel\",\n    payload)\nreq.Header.Set(\"Content-Type\", \"application/json\")\nreq.Header.Set(\"APIKEY\", \"YOUR-API-KEY\")\nresp, _ := http.DefaultClient.Do(req)\ndefer resp.Body.Close()\nbody, _ := io.ReadAll(resp.Body)\nfmt.Println(string(body))\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"$id = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\";\n$ch = curl_init(\"https://api.dev.paradisegateway.net/v1/transactions/$id/cancel\");\ncurl_setopt_array($ch, [\n    CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n    CURLOPT_HTTPHEADER => [\"Content-Type: application/json\", \"APIKEY: YOUR-API-KEY\"],\n    CURLOPT_POSTFIELDS => json_encode([\"type\" => \"cancel\", \"amount\" => 15000]),\n]);\necho curl_exec($ch); curl_close($ch);\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"require \"net/http\"; require \"json\"\nid = \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\"\nuri = URI(\"https://api.dev.paradisegateway.net/v1/transactions/#{id}/cancel\")\nreq = Net::HTTP::Post.new(uri, {\n  \"Content-Type\" => \"application/json\", \"APIKEY\" => \"YOUR-API-KEY\",\n})\nreq.body = { type: \"cancel\", amount: 15000 }.to_json\nresp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }\nputs resp.body\n","lang":"ruby"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ach-cancel","__idx":5},"children":["ACH cancel"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the appropriate cancel type for ACH transactions."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Original transaction type"},"children":["Original transaction type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Cancel type"},"children":["Cancel type"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payment"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cancel"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cancel"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"type\": \"cancel\",\n  \"amount\": 50000\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-verify-the-response","__idx":6},"children":["Step 3: Verify the response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A successful cancel returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transaction_state: canceled"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"id\": \"TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y\",\n  \"object\": \"CancelTransactionResponse\",\n  \"type\": \"cancel\",\n  \"transaction_state\": \"canceled\",\n  \"response_status\": \"Approved\",\n  \"response_code\": \"00\",\n  \"response_message\": \"The API request is approved.\",\n  \"amount\": 15000,\n  \"correlation_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The hold on the person's funds is released immediately."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Cancel vs. refund"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transaction_state"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["settled"]},", a cancel will fail. Use a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/how-tos/manage-transactions/refund-settled-auth"},"children":["refund"]}," instead."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":7},"children":["Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/how-tos/manage-transactions/refund-settled-auth"},"children":["Refund a settled transaction"]}," — return funds after settlement"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/concepts/transactions/cancels-and-refunds"},"children":["About cancels and refunds"]}]}]}]},"headings":[{"value":"Cancel an authorized transaction","id":"cancel-an-authorized-transaction","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Step 1: Confirm the transaction state","id":"step-1-confirm-the-transaction-state","depth":2},{"value":"Step 2: Cancel the transaction","id":"step-2-cancel-the-transaction","depth":2},{"value":"Card cancel","id":"card-cancel","depth":3},{"value":"ACH cancel","id":"ach-cancel","depth":3},{"value":"Step 3: Verify the response","id":"step-3-verify-the-response","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"title":"Cancel an authorized transaction","shortTitle":"Cancel a transaction","intro":"Void a transaction before settlement to release the held funds immediately. Canceling is only available before the batch closes.","type":"how-to","seo":{"title":""}},"lastModified":"2026-06-05T02:46:44.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/how-tos/manage-transactions/cancel-auth","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}