Pausar assinatura
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reasonDetails": "<string>",
"resumesAt": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reasonDetails: '<string>', resumesAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause"
payload = {
"reasonDetails": "<string>",
"resumesAt": "2023-11-07T05:31:56Z"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "sub_hsm2kigu74htdxj3nw2z6f9xw",
"number": {
"sequence": 42
},
"referenceCode": "CONTRATO-2026-0042",
"customerId": "cust_c72q6ogr9iko0we85mqal04te",
"customerEmail": "maria.silva@example.com",
"customerName": "Maria Silva",
"customerDocument": "12345678909",
"currency": "BRL",
"status": "paused",
"billingGroupId": null,
"currentPeriodStart": "2025-06-01T03:00:00.000Z",
"currentPeriodEnd": "2025-07-01T03:00:00.000Z",
"nextInvoiceAt": "2025-07-01T03:00:00.000Z",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "day_of_month",
"anchorDay": 1,
"collectionTiming": "prepaid"
},
"collectionMethod": "charge_automatically",
"collectionTiming": "prepaid",
"invoiceGenerationMode": "just_in_time",
"cancelAtPeriodEnd": false,
"canceledAt": null,
"endedAt": null,
"cancellationReason": null,
"pausedAt": "2025-06-29T13:45:30.000Z",
"pauseResumesAt": "2025-08-29T03:00:00.000Z",
"pauseReason": "cust_request",
"trialEnd": null,
"incompleteExpiresAt": null,
"trialRemindersFired": [],
"maxCycles": null,
"issuedCycles": 1,
"completedCycles": 1,
"defaultPaymentMethodRef": {
"id": "crd_tsj66oabsygc9kwvvzt8189f9",
"type": "card"
},
"splitConfig": null,
"paymentBehavior": "allow_incomplete",
"latestInvoiceId": "inv_c3qahi4qnkc258lfc14gplupt",
"paymentUpdateToken": null,
"paymentUpdateMethods": null,
"metadata": {},
"createdAt": "2025-06-01T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.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": "Subscription not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}Ciclo de vida
Pausar assinatura
Suspende a cobrança sem encerrar o contrato. O tempo parado é devolvido na retomada.
POST
/
subscriptions
/
{id}
/
pause
Pausar assinatura
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reasonDetails": "<string>",
"resumesAt": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reasonDetails: '<string>', resumesAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/subscriptions/{id}/pause"
payload = {
"reasonDetails": "<string>",
"resumesAt": "2023-11-07T05:31:56Z"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "sub_hsm2kigu74htdxj3nw2z6f9xw",
"number": {
"sequence": 42
},
"referenceCode": "CONTRATO-2026-0042",
"customerId": "cust_c72q6ogr9iko0we85mqal04te",
"customerEmail": "maria.silva@example.com",
"customerName": "Maria Silva",
"customerDocument": "12345678909",
"currency": "BRL",
"status": "paused",
"billingGroupId": null,
"currentPeriodStart": "2025-06-01T03:00:00.000Z",
"currentPeriodEnd": "2025-07-01T03:00:00.000Z",
"nextInvoiceAt": "2025-07-01T03:00:00.000Z",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "day_of_month",
"anchorDay": 1,
"collectionTiming": "prepaid"
},
"collectionMethod": "charge_automatically",
"collectionTiming": "prepaid",
"invoiceGenerationMode": "just_in_time",
"cancelAtPeriodEnd": false,
"canceledAt": null,
"endedAt": null,
"cancellationReason": null,
"pausedAt": "2025-06-29T13:45:30.000Z",
"pauseResumesAt": "2025-08-29T03:00:00.000Z",
"pauseReason": "cust_request",
"trialEnd": null,
"incompleteExpiresAt": null,
"trialRemindersFired": [],
"maxCycles": null,
"issuedCycles": 1,
"completedCycles": 1,
"defaultPaymentMethodRef": {
"id": "crd_tsj66oabsygc9kwvvzt8189f9",
"type": "card"
},
"splitConfig": null,
"paymentBehavior": "allow_incomplete",
"latestInvoiceId": "inv_c3qahi4qnkc258lfc14gplupt",
"paymentUpdateToken": null,
"paymentUpdateMethods": null,
"metadata": {},
"createdAt": "2025-06-01T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.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": "Subscription not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}POST /subscriptions/:id/pause
Faz parte do recurso Assinaturas — o conceito e os dez estados estão lá.
Leva uma assinatura active ou past_due para paused. Durante a pausa nada é cobrado, e o
contrato continua existindo — é a alternativa ao cancelamento para quem vai voltar.
O que acontece com as faturas não pagas depende do
invoiceGenerationMode:just_in_time— elas são anuladas. A retomada recomeça o ciclo e gera uma fatura nova;upfront— elas são congeladas (suspended), preservando numeração e identificadores, e voltam ao calendário na retomada, deslocadas pelo tempo parado.
404.resumesAt agenda a volta. Com ele, a assinatura retorna sozinha na data indicada; sem ele, é
preciso chamar resume. A data tem de estar no futuro — passado
responde 409.Só
active e past_due podem ser pausadas. Qualquer outro estado responde 409, inclusive
uma assinatura já pausada. reason e reasonDetails ficam registrados no histórico, para você
saber depois por que aquela pausa aconteceu.Pausar não adia o cancelamento agendado. Se a assinatura tinha
cancelAtPeriodEnd, ele
continua de pé. Para desfazê-lo, use uncancel.O
pauseReason da resposta aceita um valor a mais: admin_action. É o que aparece quando a
pausa partiu do painel, não da sua integração. O corpo desta rota não o aceita — ele só sai.Exemplo
curl -X POST https://api.sandbox.z2pay.com/v1/subscriptions/sub_x33m4yn6brazh71en4mki6f5c/pause \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{
"reason": "traveling",
"reasonDetails": "Cliente pediu pausa de dois meses por viagem.",
"resumesAt": "2026-10-10T12:00:00Z"
}'
Resposta 200
{
"id": "sub_x33m4yn6brazh71en4mki6f5c",
"status": "paused",
"pausedAt": "2026-08-10T17:30:00.000Z",
"pauseResumesAt": "2026-10-10T12:00:00.000Z",
"pauseReason": "traveling",
"currentPeriodEnd": "2026-09-10T12:00:00.000Z",
"nextInvoiceAt": "2026-09-10T12:00:00.000Z",
"updatedAt": "2026-08-10T17:30:00.000Z"
}
currentPeriodEnd e nextInvoiceAt não mudam na pausa — eles são deslocados na
retomada, quando já se sabe quanto tempo a assinatura ficou parada.Body
application/json
Response
Assinatura pausada