Get Currency Balance
Retrieve wallet balance for a specific currency. Also used to create a new currency wallet if one does not exist.
Get Balance
GET
https://api.zenpayz.com/merchant/api/v1/wallet/currency/{currency}Bearer · API key
Path Parameters
| Parameter | Type | Description |
|---|---|---|
currency REQUIRED | string | ISO 4217 currency code |
Headers
| Header | Description |
|---|---|
Authorization REQUIRED | Bearer {api_key} |
X-Signature REQUIRED | HMAC-SHA256 signature |
X-Timestamp REQUIRED | ISO 8601 timestamp |
X-Secret-Salt REQUIRED | Secret salt for HMAC validation |
Response (200 OK)
{
"success": true,
"data": {
"wallet_id": "wal_xxxxx",
"currency": "USD",
"currency_symbol": "$",
"available_balance": 250000,
"total_balance": 270000,
"blocked_balance": 5000,
"pending_balance": 15000,
"lifetime_balance": 1500000,
"lifetime_withdrawn": 1230000,
"status": "ACTIVE",
"last_transaction_at": "2024-01-15T10:30:00.000Z"
}
}
Create Currency Wallet
POST
https://api.zenpayz.com/merchant/api/v1/wallet/currency/{currency}Bearer · API key
Creates a new wallet for the specified currency.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
currency REQUIRED | string | ISO 4217 currency code |
Response (201 Created)
{
"success": true,
"data": {
"wallet_id": "wal_eur_001",
"currency": "EUR",
"currency_symbol": "€",
"available_balance": 0,
"total_balance": 0,
"blocked_balance": 0,
"pending_balance": 0,
"lifetime_balance": 0,
"lifetime_withdrawn": 0,
"status": "ACTIVE",
"last_transaction_at": "2024-01-15T10:30:00.000Z"
}
}
Examples
- cURL
- SDK
# Get balance for a currency
curl -X GET "https://api.zenpayz.com/merchant/api/v1/wallet/currency/USD" \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt"
# Create a new currency wallet
curl -X POST "https://api.zenpayz.com/merchant/api/v1/wallet/currency/EUR" \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt"
// Get balance for a currency
const balance = await zenpays.wallet.getBalance('USD');
console.log(`Available: ${balance.available}`);
// Create a new currency wallet via REST
// POST /merchant/api/v1/wallet/currency/EUR