curl --request POST \
--url https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}'
import requests
url = "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload = {
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch(
"https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
cancelledReasonCode: "Requested by customer",
cancelledReasonDescription: "Customer no longer needs the item",
}),
}
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"cancelledReasonCode" => "Requested by customer",
"cancelledReasonDescription" => "Customer no longer needs the item"
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload := strings.NewReader(`{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\"cancelledReasonCode\":\"Requested by customer\",\"cancelledReasonDescription\":\"Customer no longer needs the item\"}")
.asString();
{
"success": true,
"message": "Payment cancelled successfully"
}
{
"name": "BAD_REQUEST",
"message": "Cannot cancel an AUTO_CAPTURE or already captured payment",
"status": 400,
"errors": []
}
{
"name": "NOT_FOUND",
"message": "Payment not found",
"status": 404,
"errors": []
}
Card on File
Manual Cancel Payment
Cancel payment via the Atoa Card on File API, request parameters, response schema and code samples in cURL, Python, JavaScript, PHP, Go and Java.
POST
/
api
/
payments
/
card
/
payment-request
/
{paymentRequestId}
/
cancel
curl --request POST \
--url https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}'
import requests
url = "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload = {
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch(
"https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
cancelledReasonCode: "Requested by customer",
cancelledReasonDescription: "Customer no longer needs the item",
}),
}
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"cancelledReasonCode" => "Requested by customer",
"cancelledReasonDescription" => "Customer no longer needs the item"
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload := strings.NewReader(`{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\"cancelledReasonCode\":\"Requested by customer\",\"cancelledReasonDescription\":\"Customer no longer needs the item\"}")
.asString();
{
"success": true,
"message": "Payment cancelled successfully"
}
{
"name": "BAD_REQUEST",
"message": "Cannot cancel an AUTO_CAPTURE or already captured payment",
"status": 400,
"errors": []
}
{
"name": "NOT_FOUND",
"message": "Payment not found",
"status": 404,
"errors": []
}
Cancel a previously authorized card payment. This releases the hold on the customer’s card.
Only applicable for
Request Body Schema
Response
MANUAL_CAPTURE and CAPTURE_BEFORE_EXPIRY payments that have not yet been captured. Cannot cancel AUTO_CAPTURE or already captured payments.
Authorization
Bearer<accessSecret>
Path Parameters
string
required
The payment request ID from the Charge Saved Card response.
string
Reason for cancellation.
Possible values
Possible values
Duplicate— Duplicate paymentAbandoned— Payment was abandonedRequested by customer— Customer requested cancellationOther— Other reason (requirescancelledReasonDescription)
string
Additional cancellation notes. Max 60 characters. Required when
cancelledReasonCode is Other.boolean
true if the payment was cancelled successfully.string
Confirmation message.
curl --request POST \
--url https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}'
import requests
url = "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload = {
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch(
"https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
cancelledReasonCode: "Requested by customer",
cancelledReasonDescription: "Customer no longer needs the item",
}),
}
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"cancelledReasonCode" => "Requested by customer",
"cancelledReasonDescription" => "Customer no longer needs the item"
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel"
payload := strings.NewReader(`{
"cancelledReasonCode": "Requested by customer",
"cancelledReasonDescription": "Customer no longer needs the item"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.atoa.me/api/payments/card/payment-request/{paymentRequestId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\"cancelledReasonCode\":\"Requested by customer\",\"cancelledReasonDescription\":\"Customer no longer needs the item\"}")
.asString();
{
"success": true,
"message": "Payment cancelled successfully"
}
{
"name": "BAD_REQUEST",
"message": "Cannot cancel an AUTO_CAPTURE or already captured payment",
"status": 400,
"errors": []
}
{
"name": "NOT_FOUND",
"message": "Payment not found",
"status": 404,
"errors": []
}
⌘I