This page will help you get started with Sqala API.
Getting started with Sqala api in 3 steps
Follow these three steps to get started with Sqala API and start creating your payments.
1
Request your Credentials
Get your credentials from the developer area in our portal. Access it through the user menu in the top left corner of our dashboard or directly via this URL click in the button Access credentials to get your AppId, AppSecret ,RefreshToken and the PublicKey.
- The AppId, AppSecret and the RefreshToken will be used to generate an Access Token
- The PublicKey is only used to Tokenize a Card..
2
Create an Access Token
All API requests must use HTTPS. Requests made over plain HTTP or without authentication will fail.
import fetch from 'node-fetch'
import { encode } from 'base-64'
const response = await fetch('https://api.sqala.tech/core/v1/access-tokens', {
headers: {
'Authorization': 'Basic ' + encode('YOUR_APP_ID' + ':' + 'YOUR_APP_SECRET'),
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
'refreshToken': 'YOUR_REFRESH_TOKEN'
})
})
const data = await response.json()
console.log(data)
output
{
"token": "eyJraWQiOiJwb1NPeDI0VHRmbDZCYjdaZ3RcL296WGpqUzMrTVlkYTNScXdON1dVSXJkbz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIyZjE5MDk0Mi1jMjY5LTQxMjQtOTNkNy01YTdmYTkwMTQ0",
"expiresIn": 3600,
"type": "Bearer"
}
3
Create your first pix payment 💰
YOUR_ACCESS_TOKEN is a token in the output of step 2.
The amount is defined in cents. eg:. 1 real must be sent as 100 in the amount field
import fetch from 'node-fetch'
const response = await fetch('https://api.sqala.tech/core/v1/pix-qrcode-payments', {
headers: {
'Authorization': 'Bearer ' + 'YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
amount: 100
})
})
Remember to:
- Always include the access token in the Authorization header
- Handle token expiration and renewal
- Store tokens securely
What's next?
Learn basic concepts before start using our API resources