Autenticação

Produção:

POSThttps://oauth2.validapay.com.br/auth/token

Sandbox:

POSThttps://oauth2-sandbox.validapay.com.br/auth/token

Escopos disponíveis

Informe o escopo desejado no parâmetro scope ao solicitar o token. Para múltiplos escopos, separe por espaço.

EscopoDescrição
pix.cob/writeCriar cobranças Pix
pix.cob/readConsultar cobranças Pix
proposals/writeCriar propostas de conta
proposals/readConsultar status de propostas
accounts/writeCriar e gerenciar contas
accounts/readConsultar informações de contas
checkouts/writeCriar checkouts
checkouts/readConsultar checkouts

Body

application/x-www-form-urlencoded

Content-Type:application/x-www-form-urlencoded
NameTypeValueRequiredDescription
grant_typetextclient_credentialsRequired- Tipo de autenticação. Valor fixo: client_credentials
client_idtext{{client_id}}(variável)Required-
client_secrettext{{client_secret}}(variável)Required-
scopetext{{scope}}(variável)Required-
const url = 'https://oauth2.validapay.com.br/auth/token';

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  body: 'grant_type=client_credentials&client_id=%7B%7Bclient_id%7D%7D&client_secret=%7B%7Bclient_secret%7D%7D&scope=%7B%7Bscope%7D%7D'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));

Response Examples

200200
{
    "access_token": "eyJraWQiOiJleGVtcGxvIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6ImFjY291bnQvcmVhZCIsImNsaWVudF9pZCI6ImV4ZW1wbG9jbGllbnRpZDEyMzQ1Njc4OTAiLCJpc3MiOiJodHRwczovL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tL3VzLWVhc3QtMV9FWEVNUExPIiwiZXhwIjoxOTAwMDAwMDAwLCJpYXQiOjE4OTk5OTY0MDB9.ASSINATURA_DE_EXEMPLO",
    "expires_in": 3600,
    "token_type": "Bearer"
}