Produtos
Criar Produto
POST
/v1/productsBase URL Produção:
https://api.validapay.com.brBase URL Sandbox:
https://sandbox.validapay.com.brAutenticação
bearerAuthorizationstring · header · obrigatório
Envie no header:
Authorization: Bearer {{token}}Cria um novo produto ou serviço com nome, descrição, preço e configurações de recorrência.
Criar produto
Scopes: products/write
| Campo | Obrig. | Tipo | Descrição |
|---|---|---|---|
name | ✅ | string | Nome do produto |
type | ❌ | string | RECURRING ONE_TIME (default RECURRING) |
statementDescriptor | ❌ | string | max 22 chars |
prices[].amount | ✅ | number | Valor em reais (> 0) |
prices[].recurrenceType | ✅ | string | WEEKLY MONTHLY QUARTERLY SEMIANNUAL YEARLY ONE_TIME |
prices[].recurrenceInterval | ❌ | number | min 1 (ex: 2 = bimestral) |
prices[].trialDays | ❌ | number | ≥ 0 |
prices[].compareAtPrice | ❌ | number | Preço "de" |
Body
application/json
Content-Type:application/json
{
"name": "Plano Premium",
"description": "Acesso completo à plataforma",
"type": "RECURRING",
"statementDescriptor": "VALIDAPAY PREMIUM",
"isActive": true,
"metadata": {},
"prices": [
{
"title": "Mensal",
"amount": 99.9,
"currency": "BRL",
"recurrenceType": "MONTHLY",
"recurrenceInterval": 1,
"trialDays": 7,
"compareAtPrice": 129.9
},
{
"title": "Anual",
"amount": 899.0,
"currency": "BRL",
"recurrenceType": "YEARLY",
"recurrenceInterval": 1
}
]
}Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | - | - |
description | string | - | - |
type | string | - | - |
statementDescriptor | string | - | - |
isActive | boolean | - | - |
metadata | object | - | - |
prices[2] | array | - | - |
Headers
| Name | Type | Value | Required |
|---|---|---|---|
| Content-Type | - | application/json | Optional |
const url = 'https://sandbox.validapay.com.br/v1/products';
const options = {
method: 'POST',
headers: {
'Authorization': 'Bearer {{token}}',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Plano Premium",
"description": "Acesso completo à plataforma",
"type": "RECURRING",
"statementDescriptor": "VALIDAPAY PREMIUM",
"isActive": true,
"metadata": {},
"prices": [
{
"title": "Mensal",
"amount": 99.9,
"currency": "BRL",
"recurrenceType": "MONTHLY",
"recurrenceInterval": 1,
"trialDays": 7,
"compareAtPrice": 129.9
},
{
"title": "Anual",
"amount": 899.0,
"currency": "BRL",
"recurrenceType": "YEARLY",
"recurrenceInterval": 1
}
]
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Response Examples
200200
{
"productId": "prod_xxx",
"name": "Plano Premium",
"prices": [
{
"priceId": "price_xxx",
"amount": 99.9,
"checkoutUrl": "https://app.validapay.com.br/pagamento/pl_xxx"
}
]
}400400
{
"code": "INVALID_PRODUCT_DATA"
}