curl --request POST \
--url https://api.sandbox.z2pay.com/v1/plans/{id}/items \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"item": {
"key": "<string>",
"name": "<string>",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": "<string>",
"metadata": {}
},
"price": {
"amount": 1,
"billingScheme": "fixed",
"currency": "BRL"
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
item: {
key: '<string>',
name: '<string>',
kind: 'recurring',
quantityDefault: 1,
displayOrder: 0,
description: '<string>',
metadata: {}
},
price: {amount: 1, billingScheme: 'fixed', currency: 'BRL'}
})
};
fetch('https://api.sandbox.z2pay.com/v1/plans/{id}/items', 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}/items"
payload = {
"item": {
"key": "<string>",
"name": "<string>",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": "<string>",
"metadata": {}
},
"price": {
"amount": 1,
"billingScheme": "fixed",
"currency": "BRL"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "pli_n8e7y0yrg2frgqpktke850zqo",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"key": "wine",
"name": "Monthly Wine Bottle",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 2,
"description": "Add-on wine bottle each cycle",
"metadata": {},
"createdAt": "2025-06-29T17:00:00.000Z",
"updatedAt": "2025-06-29T17:00:00.000Z",
"currentPrice": {
"id": "price_hmy57z19gvf70wufibh1bqstb",
"planItemId": "pli_n8e7y0yrg2frgqpktke850zqo",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"billingScheme": "fixed",
"amount": 4900,
"currency": "BRL",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"isCurrent": true,
"publishedAt": "2025-06-29T17:00:00.000Z",
"archivedAt": null,
"createdAt": "2025-06-29T17:00:00.000Z",
"updatedAt": "2025-06-29T17:00: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": "Item not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}Adicionar item ao plano
Cria um item e o seu preço inicial na mesma chamada, num plano que já existe.
curl --request POST \
--url https://api.sandbox.z2pay.com/v1/plans/{id}/items \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"item": {
"key": "<string>",
"name": "<string>",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": "<string>",
"metadata": {}
},
"price": {
"amount": 1,
"billingScheme": "fixed",
"currency": "BRL"
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
item: {
key: '<string>',
name: '<string>',
kind: 'recurring',
quantityDefault: 1,
displayOrder: 0,
description: '<string>',
metadata: {}
},
price: {amount: 1, billingScheme: 'fixed', currency: 'BRL'}
})
};
fetch('https://api.sandbox.z2pay.com/v1/plans/{id}/items', 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}/items"
payload = {
"item": {
"key": "<string>",
"name": "<string>",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": "<string>",
"metadata": {}
},
"price": {
"amount": 1,
"billingScheme": "fixed",
"currency": "BRL"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "pli_n8e7y0yrg2frgqpktke850zqo",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"key": "wine",
"name": "Monthly Wine Bottle",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 2,
"description": "Add-on wine bottle each cycle",
"metadata": {},
"createdAt": "2025-06-29T17:00:00.000Z",
"updatedAt": "2025-06-29T17:00:00.000Z",
"currentPrice": {
"id": "price_hmy57z19gvf70wufibh1bqstb",
"planItemId": "pli_n8e7y0yrg2frgqpktke850zqo",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"billingScheme": "fixed",
"amount": 4900,
"currency": "BRL",
"recurrence": {
"interval": 1,
"unit": "month",
"anchor": "subscription_start",
"collectionTiming": "prepaid"
},
"trialSpec": null,
"isCurrent": true,
"publishedAt": "2025-06-29T17:00:00.000Z",
"archivedAt": null,
"createdAt": "2025-06-29T17:00:00.000Z",
"updatedAt": "2025-06-29T17:00: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": "Item not found"
}
}{
"error": {
"code": "CONFLICT",
"message": "No refundable payment found"
}
}{
"error": "Idempotency key already used with a different request body"
}POST /plans/:id/items
Faz parte do recurso Planos e Preços — o item, o preço versionado e
os status estão lá.
Acrescenta uma linha de cobrança a um plano que já existe. O item e o seu primeiro preço nascem
juntos, e a validação roda sobre os dois antes de qualquer gravação — item sem preço não chega a
existir.
key não se repete entre os itens ativos do plano. É o nome estável pelo qual a assinatura
se refere ao item, e reusar uma que já está em uso responde 409.Arquivar um item libera a key dele — o contrário do code do plano, que fica ocupado para
sempre. Reusá-la cria um item novo, sem relação com o antigo: as assinaturas que já cobravam o
item arquivado continuam nele, porque apontam para o identificador, não para a key. Se os dois
cobram coisas diferentes, prefira uma key nova — senão dois itens distintos passam a ter o
mesmo nome no seu catálogo.409: arquivar é terminal, e o plano vira
somente leitura. Para uma oferta nova, publique um plano novo.activation nunca herda o período de teste. Mesmo que o plano tenha trialSpec, a
adesão é cobrada na primeira fatura — não há cobrança futura para diferir.Exemplo
curl -X POST https://api.sandbox.z2pay.com/v1/plans/plan_lhutpqeq2ml3stia4vn90xars/items \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{
"item": {
"key": "suporte-premium",
"name": "Suporte premium",
"kind": "recurring",
"quantityDefault": 1
},
"price": { "amount": 4900, "currency": "BRL" }
}'
{
"id": "pli_x0hn9c2eqp7wl4tzka8m3vgdi",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"key": "suporte-premium",
"name": "Suporte premium",
"kind": "recurring",
"quantityDefault": 1,
"displayOrder": 0,
"description": null,
"metadata": {},
"currentPrice": {
"id": "price_qm2v7ta6zj51ndkeb9urhwx4o",
"planItemId": "pli_x0hn9c2eqp7wl4tzka8m3vgdi",
"planId": "plan_lhutpqeq2ml3stia4vn90xars",
"amount": 4900,
"currency": "BRL",
"billingScheme": "fixed",
"isCurrent": true
},
"createdAt": "2026-08-10T15:10:00.000Z",
"updatedAt": "2026-08-10T15:10:00.000Z"
}
Authorizations
API Key da Credential (gerada no Backoffice)
Headers
Chave única para garantir idempotência da requisição
Path Parameters
ID do plano
Body
Response
Item criado, com o preço em vigor
Identificador único do registro.
ID do plano ao qual o registro pertence.
Chave única e legível (slug) do componente dentro do plano.
Nome de exibição do plano ou do componente.
Natureza da cobrança: recurring cobra a cada ciclo; activation cobra uma única vez, na fatura de adesão.
recurring, activation Quantidade padrão do componente ao instanciar a assinatura.
Ordem de exibição do componente na listagem do plano.
Descrição do item (item do plano ou linha da fatura).
Metadados livres (pares chave-valor) para uso do integrador; não afeta o processamento.
Data e hora de criação do registro (ISO 8601).
Data e hora da última atualização do registro (ISO 8601).
Versão de preço vigente do item do plano.
Show child attributes
Show child attributes