跳转至

取消未完成的支付

下列为支持取消支付功能所对应的paymentMethodtransferStatus

地区 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请求

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 字段说明

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

路径参数

参数 类型 描述
idempotencyKey String 需要取消的支付记录idempotencyKey

Response Body 字段说明

参数 类型 描述
idempotencyKey String 取消的支付记录幂等键
referenceId String 原支付记录幂等键,当前场景referenceId和idempotencyKey相同
amount Long 收款金额,单位是货币最小粒度。如 1 = 0.01BRL
country String 国家编号国际缩写码,遵循ISO 3166-1 alpha-2 code标准, 如巴西BR
currency String 货币代码,如巴西BRL
finalAmount Long 用于创建收款订单的最终金额。对于需要转换汇率的收款订单,这个字段的值表示源请求金额被转换后的金额。
finalCurrency String finalAmount的收款货币代码
createTime String 交易创建时间
scheduledTime String 执行时间
finalStatusTime String 交易终态的更新时间
payer JSON 买家个人信息
transferDetails JSON 交易其他详细信息
transferStatus String 支付状态,枚举值,当前场景是CANCELLED
transferStatusCode Integer 此次请求的状态码, 200表示成功
transferErrorMsg String 此次请求失败原因
subMerchantId String 子商户ID。

Payer 对象字段说明

参数 类型 描述
name String 名字,全称(入参名字规范:只允许大小写字母,数字和空格的组合。请勿包含西班牙语和葡萄牙语字母,以及其他特殊字符。)
email String 邮箱.
phone String 手机号码.
document JSON 可确认身份的证件,例如巴西居民的CPF.
billingAddress JSON 账单邮寄地址.

document 对象字段说明

参数 类型 描述
documentId String 证件号
type String 证件类型,枚举值: CPF 或 CNPJ

billingAddress 对象字段说明

参数 类型 描述
zipCode String 邮政编码,如巴西的CEP
state String 州,缩写,如圣保罗是SP
city String 城市.
district String 区县.
street String 街道.
number String 门牌号.
complement String 补充信息.
country String 国家代码.

transferDetails 对象字段说明

参数 类型 描述
pix JSON pix 相关详细信息

pix 对象字段说明

参数 类型 描述
qrCode String 二维码
qrCodeType String 二维码类型枚举,STATIC,DYNAMIC
expirationTime String 支付期限
回到页面顶部