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.zenpays.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": {
"currency": "USD",
"availableBalance": 250000,
"totalBalance": 270000,
"blockedBalance": 5000,
"pendingBalance": 15000,
"lifetimeBalance": 1500000,
"lifetimeWithdrawn": 1230000,
"lastUpdated": "2024-01-15T10:30:00.000Z",
"status": "ACTIVE",
"settlementFrequency": "daily"
}
}
Create Currency Wallet
POST
https://api.zenpays.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": {
"currency": "EUR",
"availableBalance": 0,
"totalBalance": 0,
"blockedBalance": 0,
"pendingBalance": 0,
"lifetimeBalance": 0,
"lifetimeWithdrawn": 0,
"lastUpdated": "2024-01-15T10:30:00.000Z",
"status": "ACTIVE",
"settlementFrequency": "manual"
}
}
Examples
- cURL
- SDK
# Get balance for a currency
curl -X GET "https://api.zenpays.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.zenpays.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.availableBalance}`);
// Create a new currency wallet
const newWallet = await zenpays.wallet.create('EUR');