Skip to content

Cancel a Payment

Cancel payments with the supported listed paymentMethod and transferStatus.

Country paymentMethod transferStatus
Brazil PIX_DYNAMIC_QR IN_PROGRESS
Brazil BOLETO IN_PROGRESS
Brazil CREDIT_CARD AUTHORIZED
Brazil AME_QR IN_PROGRESS
Brazil PIC_PAY IN_PROGRESS
Brazil MERCADO_PAGO IN_PROGRESS

HTTP Request

POST /v1/payments/charges/cancel/{{idempotencyKey}}

Request Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer {{access_token}}",
    "x-api-key": "{{api_key}}"
}
Content-Type: application/json
{
    "transferStatusCode": 200,
    "transferErrorMsg": null,
    "idempotencyKey": "20220602-001",
    "referenceId": "20220602-001",
    "paymentMethod": "PIX_DYNAMIC_QR",
    "amount": 100,
    "currency": "BRL",
    "country": "BR",
    "finalAmount": 100,
    "finalCurrency": "BRL",
    "createTime": "2022-06-02 11:45:44 GMT+08:00",
    "scheduledTime": "2022-06-02 12:32:39 GMT+08:00",
    "finalStatusTime": "2022-06-02 11:47:23 GMT+08:00",
    "payer": {
        "name": "Thiago Gabriel",
        "document": {
            "documentId": "00740886967",
            "type": "CPF"
        },
        "email": "thiago@example.com",
        "phone": "+55 81987654321",
        "billingAddress": {  
            "zipCode": "04849333",
            "state": "SP",
            "city": "sao paulo",
            "district": "Jardim Gaivotas",
            "street": "Rua 9 de setembro",
            "number": "15",
            "complement": "casa",
            "country": "BR"
        }
    },
    "transferStatus": "CANCELLED",
    "description": "hello world",
    "callbackUrl": "http://api.client.com/notifications",
    "transferDetails": {
        "pix": {
            "qrCode": "00020101021226580014BR.GOV.BCB.PIX01366b780a05-2659-4c6c-80d2-a8bd20c8396f52040000530398654041.005802BR5925Liquido Brl Pagamentos Di6014Belo Horizonte61083038040362290525ftg0pwqTUpQyFNXEXPzNuWQvL6304B717",
            "qrCodeType": "DYNAMIC",
            "expirationTime": "2023-09-22 11:01:27 UTC"
        }
    },
    "subMerchantId": "UUID"
}

HTTP Headers Details

Key Value
Authorization "bearer" + " " + {{access_token}}
x-api-key {{api_key}}

PATH and Query Parameters

Parameter Type Description
idempotencyKey String The idempotency key of the payment which need to cancel

Response Body Details

Parameter Type Description
idempotencyKey String Unique key of payment record.
referenceId String Unique key of payment record which cancelled. current scene referenceId is equal idempotencyKey
amount Long The payment amount. The minimum settlement granularity of the current currency, such as 100=1BRL
country String Country code
currency String The currency of the transferred fund
finalAmount Long The final amount that is used for creating the charge order. EX: for charge orders with FX conversion, this field represents the converted amount from the original requested amount.
finalCurrency String The currency code of the finalAmount.
createTime String Payment ticket created time.
scheduledTime String Transfer ticket scheduled time
finalStatusTime String Transfer final status update time.
payer JSON Payer info
transferDetails JSON Transaction details info
transferStatus String Transfer status, should be CANCELLED if success.
transferStatusCode Integer Transfer status code, 200 if CANCELLED.
transferErrorMsg String Transfer error message if failed.
subMerchantId String The sub merchant ID.

Payer Object Parameters

Parameter Type Description
name String fullname(Input specification: Only a combination of uppercase and lowercase letters, numbers and spaces is allowed. Spanish and Portuguese letters, and other special characters are not allowed).
email String email.
phone String Mobile Phone number.
document JSON Wallet holder identity proof, such as CPF for Brazil.
billingAddress JSON Billing address info.

document Object Parameters

Parameter Type Description
documentId String identity number
type String enum of CPF or CNPJ

billingAddress Object Parameters

Parameter Type Description
zipCode String zip code. such as CEP in Brazil
state String state. should be abbreviation, such as SP in Brazil
city String city name.
district String district name.
street String street name.
number String street number.
complement String complement info.
country String country code.

transferDetails Object Parameters

Parameter Type Description
pix JSON pix detail info

pix Object Parameters

Parameter Type Description
qrCode String barcode of pix order
qrCodeType String enum value of STATIC, DYNAMIC
expirationTime String expird time
Back to top