Skip to main content
GET
/
api
/
v1
/
merchants
/
{merchantID}
/
balance
curl -X GET "https://api.yourdomain.com/api/v1/merchants/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d/balance" \
  -H "Authorization: Bearer uwk_YOUR_API_KEY_HERE"
{
  "balance": "50000.00"
}

Endpoint

GET /api/v1/merchants/{merchantID}/balance

Authentication

Authorization
string
required
Bearer token with your API key. Must have Read Balance permission.

Path Parameters

merchantID
string
required
The unique identifier of the merchant. Must match the merchant ID associated with the API key.

Response

balance
string
The current balance of the merchant’s wallet as a decimal string (e.g., “50000.00”)
curl -X GET "https://api.yourdomain.com/api/v1/merchants/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d/balance" \
  -H "Authorization: Bearer uwk_YOUR_API_KEY_HERE"
{
  "balance": "50000.00"
}

Use Cases

  • Balance Monitoring: Automated alerts when balance reaches a threshold
  • Dashboard Integration: Display current balance in POS or admin systems
  • Reconciliation: Regular balance checks for accounting purposes
  • Pre-payout Validation: Check available balance before requesting payouts

Example: Balance Monitoring Script

const axios = require('axios');

const MERCHANT_ID = 'a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d';
const API_KEY = process.env.UNIVERSAL_WALLET_API_KEY;
const ALERT_THRESHOLD = 100000.00;

async function checkBalance() {
  try {
    const response = await axios.get(
      `https://api.yourdomain.com/api/v1/merchants/${MERCHANT_ID}/balance`,
      {
        headers: { 'Authorization': `Bearer ${API_KEY}` }
      }
    );

    const balance = parseFloat(response.data.balance);
    console.log(`Current balance: ${balance}`);

    if (balance >= ALERT_THRESHOLD) {
      console.log('Balance above threshold - consider requesting a payout');
      // Send notification
    }

    return balance;
  } catch (error) {
    console.error('Failed to check balance:', error.message);
  }
}

// Run every hour
setInterval(checkBalance, 60 * 60 * 1000);
checkBalance(); // Initial check