Buscar plano por ID
curl --request GET \
--url https://api.sandbox.z2pay.com/v1/plans/{id} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sandbox.z2pay.com/v1/plans/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/plans/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "plan_lhutpqeq2ml3stia4vn90xars",
"code": "pro-monthly",
"name": "Pro Plan",
"description": "Pro tier with all features",
"status": "active",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"metadata": {},
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.000Z",
"items": [
{
"id": "pli_oaimno59ai3uuqwq0ti7gxs0j",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"key": "default",
"name": "Pro Subscription",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": null,
"metadata": {},
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.000Z",
"currentPrice": {
"id": "price_l1r8693wk6ksbd9044bwvwu93",
"planItemId": "pli_oaimno59ai3uuqwq0ti7gxs0j",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"billingScheme": "fixed",
"amount": 9900,
"currency": "BRL",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"isCurrent": true,
"publishedAt": "2025-06-29T13:45:30.000Z",
"archivedAt": null,
"createdAt": "2025-06-29T13: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": "Plan not found"
}
}Planos
Buscar plano por ID
Retorna o plano com seus itens, cada um acompanhado do preço em vigor.
GET
/
plans
/
{id}
Buscar plano por ID
curl --request GET \
--url https://api.sandbox.z2pay.com/v1/plans/{id} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sandbox.z2pay.com/v1/plans/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sandbox.z2pay.com/v1/plans/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "plan_lhutpqeq2ml3stia4vn90xars",
"code": "pro-monthly",
"name": "Pro Plan",
"description": "Pro tier with all features",
"status": "active",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"metadata": {},
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.000Z",
"items": [
{
"id": "pli_oaimno59ai3uuqwq0ti7gxs0j",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"key": "default",
"name": "Pro Subscription",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": null,
"metadata": {},
"createdAt": "2025-06-29T13:45:30.000Z",
"updatedAt": "2025-06-29T13:45:30.000Z",
"currentPrice": {
"id": "price_l1r8693wk6ksbd9044bwvwu93",
"planItemId": "pli_oaimno59ai3uuqwq0ti7gxs0j",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"billingScheme": "fixed",
"amount": 9900,
"currency": "BRL",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"isCurrent": true,
"publishedAt": "2025-06-29T13:45:30.000Z",
"archivedAt": null,
"createdAt": "2025-06-29T13: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": "Plan not found"
}
}GET /plans/:id
Faz parte do recurso Planos e Preços — o conceito e os status estão
lá.
Devolve a oferta completa: o plano, seus itens e, em cada item, o preço em vigor (currentPrice).
É a leitura para montar uma tela de contratação — a listagem
devolve só o plano, sem os itens.
currency escolhe o preço, não filtra os itens. Com ela, cada item traz o preço vigente
naquela moeda; um item que não tenha preço nessa moeda aparece do mesmo jeito, com currentPrice
nulo. Sem ela, cada item traz o primeiro preço encontrado.Itens arquivados não aparecem. Arquivar um item o retira das próximas assinaturas e da
resposta desta rota. Isso não afeta as assinaturas em curso, que já o instanciaram e continuam
cobrando por ele — o item some do catálogo, não da cobrança.
A cadência e o teste vêm duas vezes, e é de propósito. Na raiz estão os do plano; dentro de
cada
currentPrice, os que aquele preço herdou quando foi criado. Divergem quando o plano mudou
depois — o que vale para uma assinatura é sempre o do preço que ela contratou.Exemplo
curl -G https://api.sandbox.z2pay.com/v1/plans/plan_lhutpqeq2ml3stia4vn90xars \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-d currency=BRL
Resposta 200
{
"id": "plan_lhutpqeq2ml3stia4vn90xars",
"code": "pro-monthly",
"name": "Plano Pro",
"status": "active",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"items": [
{
"id": "pli_oaimno59ai3uuqwq0ti7gxs0j",
"key": "default",
"name": "Assinatura Pro",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"currentPrice": {
"id": "price_l1r8693wk6ksbd9044bwvwu93",
"amount": 9900,
"currency": "BRL",
"billingScheme": "fixed",
"isCurrent": true
}
}
],
"createdAt": "2026-08-10T13:45:30.000Z",
"updatedAt": "2026-08-10T13:45:30.000Z"
}
O exemplo está abreviado — o playground ao lado mostra o corpo inteiro.
Query Parameters
Response
Plano com itens e preços em vigor