Simular antecipação
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/anticipations/simulations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"recipientId": "<string>",
"amount": 1
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({recipientId: '<string>', amount: 1})
};
fetch('https://api.sandbox.z2pay.com/v1/anticipations/simulations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/anticipations/simulations"
payload = {
"recipientId": "<string>",
"amount": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "stl_asim_h3n8x1q6v4m9b2k7c0z5w8p3r",
"recipientId": "rec_h7d4s9k2m6p1q8w3x5z0v4b7n",
"amount": 100000,
"fee": 2500,
"netAmount": 97500,
"expiresAt": "2026-10-21T13:05:00.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": "Anticipation not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "Anticipation is available on business days, from 08:45 to 16:30 (Brasília time)."
}
}{
"error": "Idempotency key already used with a different request body"
}{
"error": {
"code": "ANTICIPATION_PROVIDER_UNAVAILABLE",
"message": "We couldn't complete your request right now. Please try again in a few moments."
}
}Antecipações
Simular antecipação
Mostra o custo e quanto cai na conta do recebedor antes de você pedir a antecipação.
POST
/
anticipations
/
simulations
Simular antecipação
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/anticipations/simulations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"recipientId": "<string>",
"amount": 1
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({recipientId: '<string>', amount: 1})
};
fetch('https://api.sandbox.z2pay.com/v1/anticipations/simulations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/anticipations/simulations"
payload = {
"recipientId": "<string>",
"amount": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "stl_asim_h3n8x1q6v4m9b2k7c0z5w8p3r",
"recipientId": "rec_h7d4s9k2m6p1q8w3x5z0v4b7n",
"amount": 100000,
"fee": 2500,
"netAmount": 97500,
"expiresAt": "2026-10-21T13:05:00.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": "Anticipation not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "Anticipation is available on business days, from 08:45 to 16:30 (Brasília time)."
}
}{
"error": "Idempotency key already used with a different request body"
}{
"error": {
"code": "ANTICIPATION_PROVIDER_UNAVAILABLE",
"message": "We couldn't complete your request right now. Please try again in a few moments."
}
}POST /anticipations/simulations
Faz parte do recurso Antecipações — o passo a passo e os status estão lá.
Calcula, para o amount pedido, o custo (fee) e quanto cai na conta do recebedor
(netAmount). Simular não pede nada: nenhum dinheiro se move e nada é cobrado. Para antecipar,
confirme a simulação com POST /anticipations.
A simulação vale 5 minutos. Depois do
expiresAt, confirmar responde 404 e é preciso simular
de novo — o custo pode ter mudado nesse meio-tempo.Fora da janela, sem habilitação ou acima do disponível, a resposta é
409. A janela é de dias
úteis, no horário de window da consulta de disponível, e o
amount não pode passar do available dela. Consulte antes de simular.amount é o que sai das vendas futuras; netAmount é o que chega na conta. O custo é
descontado do valor pedido, não somado a ele: pedir 100000 com custo de 2500 deposita 97500.Exemplo
curl -X POST https://api.sandbox.z2pay.com/v1/anticipations/simulations \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{
"recipientId": "rec_h7d4s9k2m6p1q8w3x5z0v4b7n",
"amount": 100000
}'
Resposta 201
{
"id": "stl_asim_h3n8x1q6v4m9b2k7c0z5w8p3r",
"recipientId": "rec_h7d4s9k2m6p1q8w3x5z0v4b7n",
"amount": 100000,
"fee": 2500,
"netAmount": 97500,
"expiresAt": "2026-10-21T13:05:00.000Z"
}
Body
application/json
Response
Simulação criada