Request to cancel a charge
POST/charge/:merchantChargeId/refund
Cancel all or part of a charge
Request​
Path Parameters
Possible values: >= 6 characters
and <= 36 characters
, Value must match regular expression ^([a-zA-Z0-9-]+$)$
Unique external identifier for the charge, defined by the merchant's system.
Header Parameters
Optional string that identifies the e-commerce platform or integration system used by the customer to send the request, such as 'vtex', 'irroba', etc.
- application/json
Body
Possible values: >= 1
Payment amount in cents
Responses​
- 200
- 400
- 401
- 415
- 500
OK
- application/json
- Schema
- Example (from schema)
- Example
Schema
Array [
]
Possible values: [CANCELED
, DENIED
, ERROR
, PAID
, PARTIAL
, PRE_AUTHORIZED
, REFUNDED
, CHARGEBACK
]
transactions
object[]
Possible values: [CREDIT
, WALLET
, PIX
]
Enum [ CREDIT(Credit card), WALLET(QRCode PicPay), PIX(Pix)]
Possible values: [CANCELED
, CHARGEBACK
, DENIED
, ERROR
, EXPIRED
, PAID
, PARTIALLY_REFUNDED
, PENDING
, PRE_AUTHORIZED
, REFUNDED
]
ISO 8601 format. Example: 2022-05-01T16:00:00-03:00 (means it was created on 01/05/2022 at 16:00 in the -03:00 time zone)
ISO 8601 format. Example: 2022-05-01T16:00:00-03:00 (means it was updated on 01/05/2022 at 16:00 in the -03:00 time zone)
credit
object
Possible values: [VISA
, MASTERCARD
, AMEX
, ELO
, HIPERCARD
]
Possible values: non-empty
, Value must match regular expression ^[\p{L} ]+$
Possible values: Value must match regular expression ^\d{9}$|^\d{11}$|^[A-Z0-9]{9}$
Possible values: [NONE
, MERCHANT
]
Default value: NONE
Enum [ NONE(Spot transaction), MERCHANT(Transaction in installments by the merchant, i.e. without interest)]
wallet
object
Wallet response
ISO 8601 format. Example: 2022-05-01T16:00:00-03:00 (means it will expire on 01/05/2022 at 16:00 in the -03:00 time zone)
{
"merchantChargeId": "string",
"id": "string",
"chargeStatus": "PRE_AUTHORIZED",
"amount": 0,
"originalAmount": 0,
"refundedAmount": 0,
"transactions": [
{
"paymentType": "CREDIT",
"amount": 0,
"originalAmount": 0,
"refundedAmount": 0,
"transactionStatus": "PRE_AUTHORIZED",
"createdAt": "2022-05-01T16:00:00-03:00",
"updatedAt": "2022-05-01T16:00:00-03:00",
"transactionId": "string",
"softDescriptor": "string",
"errorMessage": "string",
"credit": {
"nsu": "string",
"cardNumber": "string",
"authorizationCode": "string",
"authorizationResponseCode": "string",
"brand": "VISA",
"cardholderName": "string",
"cardholderDocument": "string",
"expirationMonth": 0,
"expirationYear": 0,
"installmentNumber": 0,
"installmentType": "NONE"
},
"wallet": {
"qrCode": "string",
"qrCodeBase64": "string",
"expiresAt": "2022-05-01T16:00:00-03:00"
}
}
]
}
{
"merchantChargeId": "8086bfd7-6241-4f76-81d8-70460533ce74",
"id": "ed50d469-ae7d-4a3d-a946-6e399cb981bb",
"chargeStatus": "REFUNDED",
"amount": 0,
"originalAmount": 1000,
"refundedAmount": 1000,
"transactions": [
{
"paymentType": "CREDIT",
"amount": 0,
"originalAmount": 1000,
"refundedAmount": 1000,
"transactionStatus": "REFUNDED",
"createdAt": "2023-11-08T10:42:36-03:00",
"updatedAt": "2023-11-08T10:42:36-03:00",
"transactionId": "1100000000000000000",
"softDescriptor": "teste softDescriptor",
"errorMessage": null,
"credit": {
"nsu": "000000002",
"cardNumber": null,
"authorizationCode": "000000",
"authorizationResponseCode": "000000",
"brand": "ELO",
"cardholderName": "Pessoa da Silva",
"cardholderDocument": "35213198066",
"expirationMonth": null,
"expirationYear": null,
"installmentNumber": 0,
"installmentType": "NONE"
},
"wallet": null
}
]
}
Bad Request
- application/json
- Schema
- Example (from schema)
- Example
Schema
Array [
]
errors
object[]
{
"message": "string",
"success": true,
"errors": [
{
"message": "must be a well-formed UUID string",
"field": "merchantChargeId"
}
]
}
{
"message": "REFUND execution is unauthorized. Check if there is amount available for refund or if it has already been refunded",
"success": false,
"errors": null
}
Unauthorized
- application/json
- Schema
- Example (from schema)
- Example
Schema
Array [
]
errors
object[]
{
"message": "string",
"success": true,
"errors": [
{
"message": "must be a well-formed UUID string",
"field": "merchantChargeId"
}
]
}
{
"message": "Authorization token not found.",
"success": false,
"errors": {
"message": "Authorization token not found",
"field": "Authorization Token"
}
}
Unsupported Media Type
- application/json
- Schema
- Example (from schema)
- Example
Schema
Array [
]
errors
object[]
{
"message": "string",
"success": true,
"errors": [
{
"message": "must be a well-formed UUID string",
"field": "merchantChargeId"
}
]
}
{
"message": "Request object is invalid or incorrectly formatted",
"success": false,
"errors": null
}
Internal Server Error
- application/json
- Schema
- Example (from schema)
- Example
Schema
Array [
]
errors
object[]
{
"message": "string",
"success": true,
"errors": [
{
"message": "must be a well-formed UUID string",
"field": "merchantChargeId"
}
]
}
{
"message": "Internal Server Error",
"success": false,
"errors": null
}