Get Reward Wallet Balance
curl --request GET \
--url https://api.example.com/v1/wallet/reward \
--header 'Authorization: <authorization>' \
--header 'x-client-key: <x-client-key>'import requests
url = "https://api.example.com/v1/wallet/reward"
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-client-key': '<x-client-key>', Authorization: '<authorization>'}
};
fetch('https://api.example.com/v1/wallet/reward', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/wallet/reward",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"x-client-key: <x-client-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/wallet/reward"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/wallet/reward")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/reward")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "098aeb90-e7f7-4f81-bc2e-4963330122c5",
"balance": "45.75",
"currency": "usdc",
"isWithdrawable": true,
"type": "REWARD"
}
{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
Wallet
Get Reward Wallet Balance
Retrieve the authenticated user’s reward wallet balance and details
GET
/
v1
/
wallet
/
reward
Get Reward Wallet Balance
curl --request GET \
--url https://api.example.com/v1/wallet/reward \
--header 'Authorization: <authorization>' \
--header 'x-client-key: <x-client-key>'import requests
url = "https://api.example.com/v1/wallet/reward"
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-client-key': '<x-client-key>', Authorization: '<authorization>'}
};
fetch('https://api.example.com/v1/wallet/reward', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/wallet/reward",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"x-client-key: <x-client-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/wallet/reward"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/wallet/reward")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/reward")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "098aeb90-e7f7-4f81-bc2e-4963330122c5",
"balance": "45.75",
"currency": "usdc",
"isWithdrawable": true,
"type": "REWARD"
}
{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
Overview
Reward wallets accumulate platform incentives, cashback earnings, and promotional credits. This endpoint retrieves the current balance, currency, and withdrawal status of the authenticated user’s reward wallet. Balance updates reflect earned rewards, redemptions, and withdrawals. Use Cases:- Display user’s accumulated rewards in your application
- Show available rewards before redemption or withdrawal
- Track reward earnings over time
- Verify reward wallet status for promotional campaigns
- Transaction cashback (percentage back on card purchases)
- Referral bonuses
- Platform incentives and promotions
- Loyalty rewards
- Staking rewards
Authentication
string
required
Your public API client key that identifies your environment
string
required
Bearer token obtained from OAuth flow or direct login
Query Parameters
boolean
default:false
Set to
true to route request to US backend environment (if available for your client)Response
string
Unique identifier for the reward wallet
string
Current balance in the wallet (decimal string for precision)
string
Currency code (e.g., “usdc”, “usdt”)
boolean
Whether funds can be withdrawn from this wallet
string
Wallet type identifier, always “REWARD” for this endpoint
{
"id": "098aeb90-e7f7-4f81-bc2e-4963330122c5",
"balance": "45.75",
"currency": "usdc",
"isWithdrawable": true,
"type": "REWARD"
}
{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
Code Examples
curl -X GET "https://dev.api.baanx.com/v1/wallet/reward" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
url = "https://dev.api.baanx.com/v1/wallet/reward"
headers = {
"x-client-key": "YOUR_CLIENT_KEY",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(url, headers=headers)
reward_wallet = response.json()
print(f"Rewards Balance: {reward_wallet['balance']} {reward_wallet['currency']}")
print(f"Withdrawable: {reward_wallet['isWithdrawable']}")
const response = await fetch('https://dev.api.baanx.com/v1/wallet/reward', {
method: 'GET',
headers: {
'x-client-key': 'YOUR_CLIENT_KEY',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
const rewardWallet = await response.json();
console.log(`Rewards: ${rewardWallet.balance} ${rewardWallet.currency}`);
interface RewardWallet {
id: string;
balance: string;
currency: string;
isWithdrawable: boolean;
type: 'REWARD';
}
const response = await fetch('https://dev.api.baanx.com/v1/wallet/reward', {
method: 'GET',
headers: {
'x-client-key': 'YOUR_CLIENT_KEY',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
const rewardWallet: RewardWallet = await response.json();
Integration Patterns
Display Rewards Dashboard
async function getRewardsSummary() {
const response = await fetch('/v1/wallet/reward', {
headers: {
'x-client-key': CLIENT_KEY,
'Authorization': `Bearer ${accessToken}`
}
});
const wallet = await response.json();
return {
totalRewards: parseFloat(wallet.balance),
currency: wallet.currency.toUpperCase(),
canWithdraw: wallet.isWithdrawable,
displayText: `${wallet.balance} ${wallet.currency.toUpperCase()}`
};
}
Check Withdrawal Eligibility
async function canWithdrawRewards() {
const wallet = await fetch('/v1/wallet/reward').then(r => r.json());
const minWithdrawal = 1.0;
const balance = parseFloat(wallet.balance);
if (!wallet.isWithdrawable) {
return { eligible: false, reason: 'Withdrawals not enabled' };
}
if (balance < minWithdrawal) {
return {
eligible: false,
reason: `Minimum withdrawal is ${minWithdrawal} ${wallet.currency}`
};
}
return { eligible: true, balance, currency: wallet.currency };
}
Important Notes
Balance Precision: Balances are returned as strings to maintain precision for decimal values. Always parse as decimal types in your application.
Real-Time Updates: Reward balances update in real-time as users earn rewards through transactions, referrals, or platform activities. Consider implementing webhooks or periodic polling for live balance updates.
Withdrawal Restrictions: Some reward programs may have vesting periods, minimum balance requirements, or other restrictions. Always check
isWithdrawable before attempting withdrawals.Edge Cases
Pending Rewards
Some rewards may have confirmation delays:- Transaction cashback typically credits within 24-48 hours
- Referral bonuses may require referred user to complete verification
- Promotional rewards may vest over time
Minimum Balance
Platform may enforce minimum balances:const MIN_REWARD_BALANCE = 0.01;
if (parseFloat(wallet.balance) < MIN_REWARD_BALANCE) {
console.log('Reward balance too low to display');
}
Currency Variations
Rewards may be in different currencies:async function getTotalRewardsUSD() {
const wallet = await fetch('/v1/wallet/reward').then(r => r.json());
if (wallet.currency === 'usdc' || wallet.currency === 'usdt') {
return parseFloat(wallet.balance);
}
const rate = await getExchangeRate(wallet.currency, 'USD');
return parseFloat(wallet.balance) * rate;
}
Related Endpoints
- Withdraw from Reward Wallet - Initiate withdrawal to external wallet
- Estimate Reward Withdrawal Fees - Calculate network fees before withdrawal
- Get Wallet History - View reward transaction history
Was this page helpful?