Cancel Payment
API data
API Gateway
This API is used for payment gateway operations:
- Production: https://api.sopague.com.br/gateway
- Sandbox: https://api-hmg.sopague.com.br/gateway
- Architecture: Representational State Transfer (REST)
Introduction
To cancel a sale, use the endpoint below with a POST request. Captured transactions can only be canceled on the same day they were processed.
POST /v1/payments/{paymentId}/cancel
Via REST request with the following body:
Request
{
"amount": 1035
}
Data dictionary - Parameters
| PROPERTY | DESCRIPTION | TYPE | LOCATION | REQUIRED | SIZE |
|---|---|---|---|---|---|
| paymentId | Identifier of the transaction to be canceled. | string | path | yes | 42 |
| amount | Amount to cancel (in cents). | integer | body | yes | 10 |
- 🟢 200
- 🔴 400
- 🔴 500
Cancellation completed successfully
{
"returnCode": "0",
"description": "Canceled",
"paymentId": "020080286103040952150000006201850000000000",
"authorizationCode": "143513",
"amount": 1023,
"releaseAt": "2019-09-24T13:43:12.1952799-03:00"
}
Data dictionary - Response
| PROPERTY | DESCRIPTION | TYPE |
|---|---|---|
| ReturnCode | Return code. | string |
| Description | Return description. | string |
| PaymentId | Payment identifier. | string |
| AuthorizationCode | Cancellation authorization code. | string |
| Amount | Canceled amount (in cents). | integer |
| ReleaseAt | Cancellation timestamp. | datetime |
Request error
[
{
"tag": "__general__",
"description": "Transação não localizada, verifique os dados informados."
}
]
Data dictionary - Response
| PROPERTY | DESCRIPTION | TYPE |
|---|---|---|
| tag | Error tag | string |
| description | Error description | string |
Internal error
[
{
"tag": "",
"description": "Não foi possível executar comando. Erro desconhecido."
}
]
Data dictionary - Response
| PROPERTY | DESCRIPTION | TYPE |
|---|---|---|
| tag | Error tag | string |
| description | Error description | string |
Notes
- Cancellation limitation: Captured transactions can only be canceled on the same day.