Cancel Cash Receipt
Fully cancel a cash receipt whose issuance processing was accepted. You can cancel it before its Hometax issuance is final, but not while the original request is PENDING. The API first returns 202 Accepted. Check the final result via webhook or the status API. If the original was fully or partially canceled outside Bolta (for example, on Hometax), the API still returns 202 Accepted. The request ends as CANCEL_FAILED with the failure code CANCELLATION_TARGET_NOT_FOUND. The same applies when the original is already EXTERNALLY_CANCELED.
curl --request POST \
--url https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation \
--header 'Authorization: Basic <encoded-value>' \
--header 'Bolta-Client-Reference-Id: <bolta-client-reference-id>'import requests
url = "https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation"
headers = {
"Bolta-Client-Reference-Id": "<bolta-client-reference-id>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Bolta-Client-Reference-Id': '<bolta-client-reference-id>',
Authorization: 'Basic <encoded-value>'
}
};
fetch('https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation', 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://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Bolta-Client-Reference-Id: <bolta-client-reference-id>"
],
]);
$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://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Bolta-Client-Reference-Id", "<bolta-client-reference-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation")
.header("Bolta-Client-Reference-Id", "<bolta-client-reference-id>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Bolta-Client-Reference-Id"] = '<bolta-client-reference-id>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"issuanceKey": "9XK21ABC5KOAEIPGK8U6UO05I3EAQPLI8OE78Z1Q",
"originalIssuanceKey": "MRK98JGC5KOAEIPGK8U6UO05I3EAQPLI8OE78A3I"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}Authorizations
Headers
Enter a client reference ID between 1 and 255 characters that differs from the issuance request. The API uses this value as the cancellation request's idempotency key. If the same API key retries an identical cancellation request with the same client reference ID, the API returns 202 Accepted with the existing request's issuanceKey. If the request content or type differs, the API returns 409 Conflict with IDEMPOTENCY_CONFLICT. To check the status later, pass this value as clientReferenceId.
1 - 255\SUse this header only to reproduce a cancellation failure webhook with a test key. Enter a cancellation failure code, and the API sends the corresponding failure webhook. Cash receipt webhooks
INVALID_ISSUER, INVALID_RECIPIENT_IDENTIFIER, ORIGINAL_ISSUANCE_FAILED, CANCELLATION_TARGET_NOT_FOUND, UNKNOWN Path Parameters
Response
The API accepted the cancellation request.
curl --request POST \
--url https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation \
--header 'Authorization: Basic <encoded-value>' \
--header 'Bolta-Client-Reference-Id: <bolta-client-reference-id>'import requests
url = "https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation"
headers = {
"Bolta-Client-Reference-Id": "<bolta-client-reference-id>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Bolta-Client-Reference-Id': '<bolta-client-reference-id>',
Authorization: 'Basic <encoded-value>'
}
};
fetch('https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation', 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://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Bolta-Client-Reference-Id: <bolta-client-reference-id>"
],
]);
$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://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Bolta-Client-Reference-Id", "<bolta-client-reference-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation")
.header("Bolta-Client-Reference-Id", "<bolta-client-reference-id>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://xapi.bolta.io/v1/cashReceipts/{issuanceKey}/cancellation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Bolta-Client-Reference-Id"] = '<bolta-client-reference-id>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"issuanceKey": "9XK21ABC5KOAEIPGK8U6UO05I3EAQPLI8OE78Z1Q",
"originalIssuanceKey": "MRK98JGC5KOAEIPGK8U6UO05I3EAQPLI8OE78A3I"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"traceId": "<string>"
}