Getting startedIntroduction
Introduction
This documentation presents the platform’s payment API and explains how to integrate it into your systems. It details endpoints, request formats, and responses required to use the API.
Description
The API follows the REST standard and communicates using JSON. Requests are organized to simplify implementation and ensure consistency across available operations.
Authentication
All API requests must be authenticated using an access token following the Bearer Token.
To obtain your API credentials, go to the page Finance → Integrations in the platform dashboard.
Payment Routes Authentication
On the page Finance → Integrations, the key required to use payment routes is located in the API Credentials.
After locating your key, include it in the Authorization HTTP request header, following the pattern Bearer <sua_chave_de_api>.
const routeUrl = "https://api.securitypag.com/v1/payment";
const apiToken = "Bearer " + "SUA_CHAVE_DE_API";
const payload = {
amount: 25990,
currency: "BRL",
method: "PIX",
description: "Pagamento de assinatura",
externalRef: "order_98765",
notificationUrl: "https://example.com/webhook/payment",
payer: {
name: "John Doe",
taxId: "12345678901",
email: "john.doe@example.com",
phone: "11999999999",
},
"items": [
{
"quantity": 1,
"name": "Produto Teste",
"price": 1000,
"type": "PHYSICAL"
}
],
};
const response = await fetch(routeUrl, {
method: "POST",
headers: {
Authorization: apiToken,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
const data = await response.json();
console.log(data);Transfer Routes Authentication
For increased security, transfer routes use a different API key.
On the page Finance → Integrations, the key required to use transfer routes is located in the API Withdrawal Credentials.
After locating your key, include it in the Authorization HTTP request header, following the pattern Bearer <sua_chave_de_api>.
const routeUrl = "https://api.securitypag.com/v1/transfer";
const apiToken = "Bearer " + "SUA_CHAVE_DE_API_DE_SAQUE";
const payload = {
"amount": 1000,
"method": "PIX",
"externalRef": "transfer_123",
"notificationUrl": "https://example.com/webhook/transfer"
"pix": {
"pixKeyType": "EMAIL",
"pixKey": "email@gmail.com"
},
};
const response = await fetch(routeUrl, {
method: "POST",
headers: {
Authorization: apiToken,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
const data = await response.json();
console.log(data);Something wrong on this page? Talk to us