curl -X POST "https://pagamentos.basspago.com.br/api/v2/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://pagamentos.basspago.com.br/api/v2/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://pagamentos.basspago.com.br/api/v2/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Transferências
Autenticar conta
Gere o Bearer Token de Cash Out para autenticar as transferências
POST
/
api
/
v2
/
oauth
/
token
curl -X POST "https://pagamentos.basspago.com.br/api/v2/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://pagamentos.basspago.com.br/api/v2/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://pagamentos.basspago.com.br/api/v2/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Gere o Bearer Token de Cash Out a partir das suas credenciais e do certificado de Cash Out. O token é usado no header
Authorization das requisições de transferência (API de Contas).
O token de Cash Out expira em 3600 segundos. Renove-o antes desse prazo, contado a partir da última renovação.
Os Bearer Tokens de Cash In e Cash Out são separados. O token gerado aqui vale apenas para as requisições de Cash Out. Para recebimentos (Cash In), gere um token próprio com o certificado e as credenciais de Cash In.
Certificados
Esta rota usa autenticação mútua (mTLS). Envie o certificado de Cash Out, a chave e a senha na requisição:file
required
Certificado de Cash Out do cliente (
client.crt).file
required
Chave privada do cliente (
client.key).string
required
Senha para descriptografar a chave
.key, enviada por e-mail junto com os certificados.Headers
string
required
Formato do corpo da requisição. Use
application/json.Body
string
required
Tipo de concessão OAuth. Use
client_credentials.string
required
Client ID gerado no painel FINANCE, em Configurações → API CONTAS.
string
required
Client Secret gerado junto com o Client ID. Trate como segredo.
Resposta
string
Bearer Token usado no header
Authorization das próximas requisições.string
Tipo do token. Sempre
Bearer.integer
Tempo de expiração do token, em segundos.
3600 para Cash Out.curl -X POST "https://pagamentos.basspago.com.br/api/v2/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://pagamentos.basspago.com.br/api/v2/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://pagamentos.basspago.com.br/api/v2/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}