cURL
curl --request PUT \
--url https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel \
--header 'partner-api-key: <api-key>'import requests
url = "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel"
headers = {"partner-api-key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'partner-api-key': '<api-key>'}};
fetch('https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"partner-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("partner-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel")
.header("partner-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["partner-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "string",
"userId": "string",
"status": "CANCELLED"
}
}Transactions
Cancel Transaction
PUT
/
api
/
partner
/
v2
/
transactions
/
{id}
/
cancel
cURL
curl --request PUT \
--url https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel \
--header 'partner-api-key: <api-key>'import requests
url = "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel"
headers = {"partner-api-key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'partner-api-key': '<api-key>'}};
fetch('https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"partner-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("partner-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel")
.header("partner-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.capa.fi/api/partner/v2/transactions/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["partner-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "string",
"userId": "string",
"status": "CANCELLED"
}
}Cancels a previously created on-ramp, off-ramp, or cross-ramp transaction. Cancellation is only allowed if the transaction has not yet received funds.
Important Notes
- Only transactions in a cancellable state can be cancelled:
PENDING_PAYMENT(on-ramp and off-ramp),COMPLETED_CRYPTO_RECEIVAL(off-ramp), andWAITING_INVOICEorPENDING_FUNDS(cross-ramp). Cancelling a cross-ramp also cancels its child orders and sendsCANCELLED_CROSS_RAMP. - Completed or locked transactions cannot be cancelled.
- The transaction must belong to the authenticated partner account.
- This operation is idempotent — calling it multiple times on a cancelled transaction will not cause errors.
Use Cases
- Abort abandoned payments: Cancel stuck or forgotten transaction flows.
- Back-office controls: Let support teams reverse pending transactions before execution.
- Automatic timeout flows: Cancel after inactivity via cron jobs or watchdog logic.
Error Codes
These are the errors this endpoint returns most often. Branch oncode, not message, and handle codes you don’t recognize by their HTTP status. See Error Codes for the complete list.
Common Errors
| HTTP Status | Code | Message |
|---|---|---|
| 401 | UNAUTHORIZED | ”API Key is missing” |
| 401 | UNAUTHORIZED | ”Invalid API Key format” |
| 401 | UNAUTHORIZED | ”Invalid API Key” |
| 429 | TOO_MANY_REQUESTS | ”ThrottlerException: Too Many Requests” (wait the number of seconds in the Retry-After header) |
Endpoint-Specific Errors
| HTTP Status | Code | Message |
|---|---|---|
| 400 | INVALID_USER_INPUT_ERROR | ”Invalid User Input” |
| 404 | NOT_FOUND_ERROR | ”Requested Transaction was not found” |
| 409 | INVALID_TRANSACTION_STATE_TRANSITION | The transaction’s current status can’t be cancelled |
| 403 | PARTNER_NOT_OWNER_OF_TRANSACTION_ERROR | ”Partner is not the owner of the transaction.” |
Authorizations
API key for the affiliated partner performing the request.
Path Parameters
Transaction identifier
Example:
"8374f327-38bd-4b0b-b8a7-2524599eb903"