Produtos

Criar Produto

POST/v1/products
Base URL Produção:https://api.validapay.com.br
Base URL Sandbox:https://sandbox.validapay.com.br

Autenticaçã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

CampoObrig.TipoDescrição
namestringNome do produto
typestringRECURRING ONE_TIME (default RECURRING)
statementDescriptorstringmax 22 chars
prices[].amountnumberValor em reais (> 0)
prices[].recurrenceTypestringWEEKLY MONTHLY QUARTERLY SEMIANNUAL YEARLY ONE_TIME
prices[].recurrenceIntervalnumbermin 1 (ex: 2 = bimestral)
prices[].trialDaysnumber≥ 0
prices[].compareAtPricenumberPreç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

FieldTypeRequiredDescription
name
string-
-
description
string-
-
type
string-
-
statementDescriptor
string-
-
isActive
boolean-
-
metadata
object-
-
prices[2]
array-
-

Headers

NameTypeValueRequired
Content-Type-application/jsonOptional
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"
}