Retomar assinatura pausada
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/subscriptions/{id}/resume \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reasonDetails": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reasonDetails: '<string>'})
};
fetch('https://api.sandbox.z2pay.com/v1/subscriptions/{id}/resume', 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}/resume"
payload = { "reasonDetails": "<string>" }
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": "active",
"billingGroupId": null,
"currentPeriodStart": "2025-06-01T03:00:00.000Z",
"currentPeriodEnd": "2025-07-30T03:00:00.000Z",
"nextInvoiceAt": "2025-07-30T03: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": null,
"pauseResumesAt": null,
"pauseReason": null,
"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
Retomar assinatura pausada
Devolve uma assinatura pausada para ativa, somando o tempo parado às datas do ciclo.
POST
/
subscriptions
/
{id}
/
resume
Retomar assinatura pausada
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/subscriptions/{id}/resume \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reasonDetails": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reasonDetails: '<string>'})
};
fetch('https://api.sandbox.z2pay.com/v1/subscriptions/{id}/resume', 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}/resume"
payload = { "reasonDetails": "<string>" }
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": "active",
"billingGroupId": null,
"currentPeriodStart": "2025-06-01T03:00:00.000Z",
"currentPeriodEnd": "2025-07-30T03:00:00.000Z",
"nextInvoiceAt": "2025-07-30T03: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": null,
"pauseResumesAt": null,
"pauseReason": null,
"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/resume
Faz parte do recurso Assinaturas — o conceito e os dez estados estão lá.
Devolve uma assinatura paused para active.
O tempo parado é devolvido, não perdido.
currentPeriodEnd e nextInvoiceAt avançam
exatamente o quanto durou a pausa, então o cliente não perde ciclo nem paga pelo período em que
não usou.As faturas seguem o mesmo critério da pausa:
just_in_time— uma fatura nova é gerada na retomada, porque as anteriores foram anuladas ao pausar;upfront— as congeladas voltam ascheduled, comchargeAt,dueAt,periodStarteperiodEnddeslocados pelo tempo de pausa, e as viradas seguintes da assinatura acompanham essas datas. Elas não reabrem de imediato: cada uma reabre quando a sua nova data chegar.
upfront, pode não haver
nenhuma naquele dia.Só assinatura pausada pode ser retomada. Qualquer outro estado responde
409. Se a pausa
tinha resumesAt agendado, a retomada manual antecipa o retorno — não é preciso cancelar o
agendamento antes.A retomada tem dois motivos que você não envia:
auto_resume_scheduled, quando o resumesAt
agendado chegou, e admin_action, quando a retomada partiu do painel. Os dois aparecem no
histórico sem passar por esta rota.Exemplo
curl -X POST https://api.sandbox.z2pay.com/v1/subscriptions/sub_x33m4yn6brazh71en4mki6f5c/resume \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{
"reason": "customer_request",
"reasonDetails": "Cliente voltou da viagem e pediu a reativação."
}'
Resposta 200
{
"id": "sub_x33m4yn6brazh71en4mki6f5c",
"status": "active",
"pausedAt": null,
"pauseResumesAt": null,
"currentPeriodEnd": "2026-11-10T12:00:00.000Z",
"nextInvoiceAt": "2026-11-10T12:00:00.000Z",
"updatedAt": "2026-10-10T12:00:00.000Z"
}
As datas do exemplo saltaram dois meses em relação à pausa: é o
tempo parado sendo devolvido ao ciclo.
Body
application/json
Response
Assinatura retomada