> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.crisscross.money/api-reference/collect/payments/manage-payments/cancel-transaction/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.crisscross.money/_mcp/server. # Cancel a Transaction POST https://api.crisscross.money/v1/payment/{transactionId}/cancel Content-Type: application/json Cancels a single transaction by its identifier. The transaction is the only thing affected — the session it belongs to remains active, and any other transactions on the session continue normally. A transaction can only be cancelled while it is in a non-terminal state and while the originating provider supports cancelling an in-progress transaction. Otherwise the call returns `409`. Reference: https://docs.crisscross.money/api-reference/collect/payments/manage-payments/cancel-transaction ## Request ### Path parameters - `transactionId` (string, required) — Identifier of the transaction to cancel. UUID v7. ### Body (application/json) This endpoint expects a CancelTransactionRequest. - `reason` (string, optional) — Optional free-form reason for the cancellation, recorded for reporting. ## Response ### 200 Transaction cancelled. - `transactionId` (string, required) — Identifier of the cancelled transaction. UUID v7. - `status` (enum, required) — The resulting state of the transaction. - Allowed values: `CANCELLED` - `message` (string, required) — Human-readable status message. ## Errors ### 400 Bad Request Error Invalid request parameters. - `message` (string, required) — Human-readable description of what went wrong. - `error` (string, required) — Error category. Most endpoints return the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Conflict", "Unprocessable Entity", "Internal Server Error"). Some return a machine-readable snake_case code instead — notably the FX and rate-lock rejections on checkout session creation and payment initiation, where several distinct codes share a single HTTP status. Where a code is present it is the finer discriminator and is safe to branch on. - `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth. ### 401 Unauthorized Error Unauthorized. - `message` (string, required) — Human-readable description of what went wrong. - `error` (string, required) — Error category. Most endpoints return the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Conflict", "Unprocessable Entity", "Internal Server Error"). Some return a machine-readable snake_case code instead — notably the FX and rate-lock rejections on checkout session creation and payment initiation, where several distinct codes share a single HTTP status. Where a code is present it is the finer discriminator and is safe to branch on. - `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth. ### 404 Not Found Error Transaction not found. - `message` (string, required) — Human-readable description of what went wrong. - `error` (string, required) — Error category. Most endpoints return the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Conflict", "Unprocessable Entity", "Internal Server Error"). Some return a machine-readable snake_case code instead — notably the FX and rate-lock rejections on checkout session creation and payment initiation, where several distinct codes share a single HTTP status. Where a code is present it is the finer discriminator and is safe to branch on. - `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth. ### 409 Conflict Error Conflict — the transaction is already in a terminal state, or the originating provider does not support cancelling it at this stage. - `message` (string, required) — Human-readable description of what went wrong. - `error` (string, required) — Error category. Most endpoints return the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Conflict", "Unprocessable Entity", "Internal Server Error"). Some return a machine-readable snake_case code instead — notably the FX and rate-lock rejections on checkout session creation and payment initiation, where several distinct codes share a single HTTP status. Where a code is present it is the finer discriminator and is safe to branch on. - `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth. ### 422 Unprocessable Entity Error Unprocessable Entity. - `message` (string, required) — Human-readable description of what went wrong. - `error` (string, required) — Error category. Most endpoints return the HTTP reason phrase (e.g. "Bad Request", "Unauthorized", "Conflict", "Unprocessable Entity", "Internal Server Error"). Some return a machine-readable snake_case code instead — notably the FX and rate-lock rejections on checkout session creation and payment initiation, where several distinct codes share a single HTTP status. Where a code is present it is the finer discriminator and is safe to branch on. - `statusCode` (integer, required) — HTTP status code, mirroring the response header. The response header is the source of truth. ## Examples **Request** ```json { "reason": "Customer requested cancellation" } ``` **Response** ```json { "transactionId": "01951c8a-8b4c-7d2a-8f1e-5d6c7b8a9e10", "status": "CANCELLED", "message": "Transaction cancelled." } ``` **SDK Code** ```python import requests url = "https://api.crisscross.money/v1/payment/transactionId/cancel" payload = { "reason": "Customer requested cancellation" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.crisscross.money/v1/payment/transactionId/cancel'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"reason":"Customer requested cancellation"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.crisscross.money/v1/payment/transactionId/cancel" payload := strings.NewReader("{\n \"reason\": \"Customer requested cancellation\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.crisscross.money/v1/payment/transactionId/cancel") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"reason\": \"Customer requested cancellation\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.crisscross.money/v1/payment/transactionId/cancel") .header("Content-Type", "application/json") .body("{\n \"reason\": \"Customer requested cancellation\"\n}") .asString(); ``` ```php request('POST', 'https://api.crisscross.money/v1/payment/transactionId/cancel', [ 'body' => '{ "reason": "Customer requested cancellation" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.crisscross.money/v1/payment/transactionId/cancel"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"reason\": \"Customer requested cancellation\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["reason": "Customer requested cancellation"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.crisscross.money/v1/payment/transactionId/cancel")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```