Cancelar saque
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel"
payload = { "reason": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "wdr_unbd7bvw5wiyyo5go6e9um9dm",
"amount": 300000,
"currency": "BRL",
"fee": 4867,
"netAmount": 295133,
"status": "cancelled",
"bankAccountId": "rba_mmw0ae28gelp9xz08x2czcgx0",
"paidAt": null,
"statusHistory": [
{
"status": "requested",
"changedBy": "api",
"changedAt": "2025-06-29T13:45:30.000Z",
"reason": null
},
{
"status": "cancelled",
"changedBy": "api",
"changedAt": "2025-06-29T14:02:18.000Z",
"reason": "Cancelado via API"
}
],
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T14:02:18.000Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"issues": [
{
"path": "status",
"message": "Status inválido. Valores aceitos: pending, waiting_payment, paid, refused, canceled, refunded"
},
{
"path": "startDate",
"message": "Data deve ser ISO 8601 com timezone (ex.: 2026-06-24T00:00:00Z)"
}
]
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Withdrawal not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}Saques
Cancelar saque
Desfaz um pedido de saque que ainda não foi aprovado.
POST
/
withdrawals
/
{id}
/
cancel
Cancelar saque
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/withdrawals/{id}/cancel"
payload = { "reason": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "wdr_unbd7bvw5wiyyo5go6e9um9dm",
"amount": 300000,
"currency": "BRL",
"fee": 4867,
"netAmount": 295133,
"status": "cancelled",
"bankAccountId": "rba_mmw0ae28gelp9xz08x2czcgx0",
"paidAt": null,
"statusHistory": [
{
"status": "requested",
"changedBy": "api",
"changedAt": "2025-06-29T13:45:30.000Z",
"reason": null
},
{
"status": "cancelled",
"changedBy": "api",
"changedAt": "2025-06-29T14:02:18.000Z",
"reason": "Cancelado via API"
}
],
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T14:02:18.000Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"issues": [
{
"path": "status",
"message": "Status inválido. Valores aceitos: pending, waiting_payment, paid, refused, canceled, refunded"
},
{
"path": "startDate",
"message": "Data deve ser ISO 8601 com timezone (ex.: 2026-06-24T00:00:00Z)"
}
]
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Withdrawal not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}POST /withdrawals/:id/cancel
Faz parte do recurso Saques — os estados e o fluxo de aprovação estão lá.
Cancela o pedido e devolve o valor ao saldo disponível do recebedor.
Só funciona em
requested. Assim que o saque é aprovado, a janela fecha: approved,
processing, paid, cancelled, rejected e failed respondem 409. Não há como chamar de
volta um saque que já entrou no processamento bancário.A janela é curta e não é sua. A aprovação acontece do nosso lado, no ritmo da operação — não
há prazo garantido em que o saque continue cancelável. Se o cancelamento faz parte do seu fluxo,
trate o
409 como resultado normal, não como exceção.O valor volta ao saldo disponível, sem taxa. A taxa só é cobrada no saque que se concretiza.
Exemplo
curl -X POST https://api.sandbox.z2pay.com/v1/withdrawals/wdr_unbd7bvw5wiyyo5go6e9um9dm/cancel \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
Resposta 200
{
"id": "wdr_unbd7bvw5wiyyo5go6e9um9dm",
"amount": 300000,
"currency": "BRL",
"status": "cancelled",
"paidAt": null,
"statusHistory": [
{
"status": "requested",
"changedBy": "api",
"changedAt": "2026-08-11T13:00:00.000Z",
"reason": null
},
{
"status": "cancelled",
"changedBy": "api",
"changedAt": "2026-08-11T13:12:00.000Z",
"reason": null
}
],
"updatedAt": "2026-08-11T13:12:00.000Z"
}
Authorizations
API Key da Credential (gerada no Backoffice)
Headers
Chave única para garantir idempotência da requisição
Path Parameters
ID do saque
Body
application/json
Motivo do cancelamento do saque.
Minimum string length:
1Response
Saque cancelado
Identificador único do registro.
Valor bruto em centavos
Moeda no padrão ISO 4217 (ex.: BRL).
Taxa em centavos
Valor líquido (amount - fee) em centavos
Situação do saque. Valores: requested, approved, processing, paid, cancelled, rejected, failed.
ID da conta bancária de destino do saque.
Data e hora em que o pagamento foi liquidado (ISO 8601).
Histórico de mudanças de status do saque.
Show child attributes
Show child attributes
Data e hora de criação do registro (ISO 8601).
Data e hora da última atualização do registro (ISO 8601).