Generate bearer token
curl --request POST \
--url https://api.tandapay.io/api/b2b/auth/generate-bearer-token \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"publicKey": "pk_live_xxxxxxxxxxxxxxxx"
}
'const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({publicKey: 'pk_live_xxxxxxxxxxxxxxxx'})
};
fetch('https://api.tandapay.io/api/b2b/auth/generate-bearer-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tandapay.io/api/b2b/auth/generate-bearer-token"
payload = { "publicKey": "pk_live_xxxxxxxxxxxxxxxx" }
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tandapay.io/api/b2b/auth/generate-bearer-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publicKey' => 'pk_live_xxxxxxxxxxxxxxxx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": 1767225600
}{
"success": false,
"message": "Unauthorized"
}Authentication
Generate bearer token
Exchange your keys for a one-hour bearer token.
POST
/
api
/
b2b
/
auth
/
generate-bearer-token
Generate bearer token
curl --request POST \
--url https://api.tandapay.io/api/b2b/auth/generate-bearer-token \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"publicKey": "pk_live_xxxxxxxxxxxxxxxx"
}
'const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({publicKey: 'pk_live_xxxxxxxxxxxxxxxx'})
};
fetch('https://api.tandapay.io/api/b2b/auth/generate-bearer-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tandapay.io/api/b2b/auth/generate-bearer-token"
payload = { "publicKey": "pk_live_xxxxxxxxxxxxxxxx" }
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tandapay.io/api/b2b/auth/generate-bearer-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publicKey' => 'pk_live_xxxxxxxxxxxxxxxx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": 1767225600
}{
"success": false,
"message": "Unauthorized"
}Call this endpoint from your server only. Anyone holding your API key can move money on your account.
Authorizations
Your secret API key. Used only to generate a bearer token.
Body
application/json
Your public key from Developers → API keys in the dashboard.
Example:
"pk_live_xxxxxxxxxxxxxxxx"

