Autenticação

Obter token

/api/v3/oauth/token POST

Parâmetros da solicitação

Parâmetros de URL

{
    "grant_type":"client_credentials",
    "app_id": "a0c07e56c281c23c9b0bfd949xxxxx",
    "app_secret": "e8b22b824d460565f853c8xxxxxx"
}
curl --location 'https://api.starpago.com/api/v3/oauth/token' \
--header 'Content-Type: application/json' \
--data '{
    "grant_type":"client_credentials",
    "app_id": "a0c07e56c281c23c9b0bfd949xxxxx",
    "app_secret": "e8b22b824d460565f853c8xxxxxx"
}'

Retornando respostas

{
    "code": 0,
    "msg": "success",
    "data": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtaWQiOjEwMCwidHlwZSI6Im1lcmNoYW50IiwiaXNzIjoic3RhcnBhZ28iLCJleHAiOjE3MjU0NTY0NzN9.TTWj2Ctem2qfPhLtvpx4XG5lrXUH4veQD7dsQb0B9SI",
        "token_type": "Bearer",
        "expires_in": 1800
    }
}

Autenticação

Após obter o token, é necessário adicioná-lo ao cabeçalho da solicitação para realizar chamadas subsequentes à API. Por exemplo:

curl --location 'https://api.starpago.com/api/v3/merchant/balance' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtaWQiOjEwMCwidHlwZSI6Im1lcmNoYW50IiwiaXNzIjoic3RhcnBhZ28iLCJleHAiOjE3MjU0NTY0NzN9.TTWj2Ctem2qfPhLtvpx4XG5lrXUH4veQD7dsQb0B9SI'