Cancel Payment

A payment with a PENDING status due to an AUTHORIZE transaction status can be canceled before it is completed if the payment is no longer required. Sending a cancel request will update the payment status to CANCELLED.

3DS Payments

Payments in a PENDING status due to 3DS authentication cannot be canceled. These payments are in a temporary state awaiting user authentication. The payment status will automatically update to either FRAUD VERIFIED or CANCELLED based on the outcome of the authentication process.

Alternative Payment Methods

Alternative payment methods such as PIX also support payment cancellation with a PENDING status. Reach out to your technical account manager for more information.

If you need a receipt for the canceled transaction, you can retrieve it after it has been created. To do this, use the Retrieve Payment by ID endpoint and check the receipt_url field in the payment.transaction object. See The Payment Object for receipt, receipt_url, and receipt_language.

To use this endpoint, you have to provide an X-Idempotency-Key in your request. Check the Authentication page for more information.

POST/payments/{payment_id}/transactions/{transaction_id}/cancel

Path Parameters

payment_idstringrequired

The unique identifier of the payment (UUID, 36 chars).

transaction_idstringrequired

The unique identifier of the transaction (UUID, 36 chars).

Body application/json

descriptionstring

Description of the cancellation.(MAX 255; MIN 3)

reason"DUPLICATE" | "FRAUDULENT" | "REQUESTED_BY_CUSTOMER"

Reason for the cancellation. Values can be DUPLICATE, FRAUDULENT, and REQUESTED_BY_CUSTOMER.

merchant_referencestringrequired

Identification of the payment transaction defined by the merchant (MAX 255; MIN 3).

response_additional_dataobject

Specifies additional data for required the transaction response

Show response_additional_data properties
receiptboolean

Indicates if a receipt is necessary for the transaction response

receipt_language"ES" | "EN" | "PT"

Indicates the language of the receipt to be generated

transactions_historyboolean

When true, includes the transactions history in the response

raw_requestboolean

When true, includes the provider raw request in the output

raw_responseboolean

When true, includes the provider raw response in the output

Response

200

idstring
typestring
statusstring
categorystring
amountobject
Show amount properties
capturedinteger
currencystring
currency_conversionany
refundedinteger
valueinteger
merchant_referencestring
created_atstring
updated_atstring
provider_dataobject
Show provider_data properties
idstring
transaction_idstring
account_idstring
statusstring
sub_statusstring
status_detailstring
response_messageany
response_codestring
raw_requestobject

Obfuscated copy of the request WHITELABEL sent to the provider. Only returned for allowlisted organizations.

raw_responseobject
Show raw_response properties
messagestring
third_party_transaction_idany
third_party_account_idany
iso8583_response_codestring
iso8583_response_messagestring
connection_dataobject
Show connection_data properties
idstring
namestring
response_codestring
response_messagestring
paymentobject
Show payment properties
idstring
account_idstring
descriptionstring
countrystring
statusstring
sub_statusstring
merchant_order_idstring
created_atstring
updated_atstring
amountobject
Show amount properties
capturedinteger
currencystring
currency_conversionany
refundedinteger
valueinteger
split_marketplaceany[]
customer_payerany
simplified_modeboolean
receiptboolean
receipt_urlany
receipt_languageany

400

codestring
messagesstring[]

401

codestring
messagesstring[]

403

codestring
messagesstring[]
Request
curl -X POST "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" \
  -H "Content-Type: application/json" \
  -H "public-api-key: <public-api-key>" \
  -H "private-secret-key: <private-secret-key>" \
  -H "X-Idempotency-Key: <X-Idempotency-Key>" \
  -d '{
  "description": "string",
  "reason": "DUPLICATE",
  "merchant_reference": "string",
  "response_additional_data": {
    "receipt": true,
    "receipt_language": "ES",
    "transactions_history": true,
    "raw_request": true,
    "raw_response": true
  }
}'
Response
{
  "id": "438bea6c-9061-4416-b824-469c3c05868d",
  "type": "CANCEL",
  "status": "SUCCEEDED",
  "category": "CARD",
  "amount": {
    "captured": 0,
    "currency": "USD",
    "currency_conversion": null,
    "refunded": 0,
    "value": 30000
  },
  "merchant_reference": "",
  "created_at": "2024-06-06T14:03:08.384014Z",
  "updated_at": "2024-06-06T14:03:08.453617Z",
  "provider_data": {
    "id": "YUNO_TEST_PAYMENT_GW",
    "transaction_id": "",
    "account_id": "",
    "status": "SUCCEEDED",
    "sub_status": "",
    "status_detail": "SUCCEEDED",
    "response_message": null,
    "response_code": "SUCCEEDED",
    "raw_request": {},
    "raw_response": {
      "message": "provider response"
    },
    "third_party_transaction_id": null,
    "third_party_account_id": null,
    "iso8583_response_code": "00",
    "iso8583_response_message": "Approved or completed successfully"
  },
  "connection_data": {
    "id": "58cc35f4-faef-4107-8e09-d18d60121d38",
    "name": "Connection name"
  },
  "response_code": "SUCCEEDED",
  "response_message": "Transaction successful",
  "payment": {
    "id": "2d6f75c1-c4bc-4d2d-80ec-0af4d12c85da",
    "account_id": "",
    "description": "Test",
    "country": "US",
    "status": "CANCELED",
    "sub_status": "CANCELED",
    "merchant_order_id": "0000023",
    "created_at": "2024-06-06T14:01:34.286228Z",
    "updated_at": "2024-06-06T14:03:08.484781Z",
    "amount": {
      "captured": 0,
      "currency": "USD",
      "currency_conversion": null,
      "refunded": 0,
      "value": 30000
    },
    "split_marketplace": [
      null
    ]
  },
  "customer_payer": null,
  "simplified_mode": false,
  "receipt": false,
  "receipt_url": null,
  "receipt_language": null
}