Produtos

Atualizar Produto

PUT/v1/products/:id
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}}

Path Parameters

NameTypeRequiredDescription
idstringRequiredId

Atualiza as informações de um produto, como nome, descrição ou preço.

Atualizar produto

Mesmos campos de POST (todos opcionais). Para atualizar preço existente, inclua priceId no item de prices[].

Body

application/json

Content-Type:application/json
{
  "name": "Plano Premium Plus",
  "prices": [
    {
      "priceId": "price_xxx",
      "amount": 109.9
    },
    {
      "title": "Trimestral",
      "amount": 279.0,
      "recurrenceType": "QUARTERLY"
    }
  ]
}

Schema

FieldTypeRequiredDescription
name
string-
-
prices[2]
array-
-

Headers

NameTypeValueRequired
Content-Type-application/jsonOptional
const url = 'https://sandbox.validapay.com.br/v1/products/:id';

const options = {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer {{token}}',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "name": "Plano Premium Plus",
  "prices": [
    {
      "priceId": "price_xxx",
      "amount": 109.9
    },
    {
      "title": "Trimestral",
      "amount": 279.0,
      "recurrenceType": "QUARTERLY"
    }
  ]
})
};

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 Plus",
  "newPrices": [
    {
      "priceId": "price_yyy"
    }
  ]
}
404404
{
  "code": "PRODUCT_NOT_FOUND"
}