Get Balance
Check the balance of all the accounts you have access to.
Path Parameters
Query Parameters
Currency code of your deposit account. If not provided, the default value will be DRE. Allowed values: USD, AUD, EUR, GBP, BRL, CAD, CHF Example: BRL
ID of your recipient Example: 12
Response
This status is returned in the following scenarios:
The search was successful
When the currency is incorrectly provided, the return will have this status with zeroed values
When the merchant has no accounts, the return will have this status with zeroed values
This field will only be different from null when the account is configured to receive fees in a wallet. Other than in this case, the balance of the other fee account(wallet) that will receive the fees is returned. Default: null Example: 100
Request Example
curl --request GET \
--url 'https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/balance' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
200 OK
500 Internal Server Error
{
"balance" : 10000 ,
"available_balance" : 10000 ,
"reserve_balance" : 0
}
Response Fields
balance
The total balance in the account.
available_balance
The balance available for withdrawal or transactions.
reserve_balance
The amount held in reserve (if applicable).
fee
Fee balance (only applicable when the account is configured to receive fees in a wallet).
Use Cases
Before processing a transaction, check if the merchant has sufficient available balance: const balance = await getBalance ( merchantId );
if ( balance . available_balance >= transactionAmount ) {
// Proceed with transaction
} else {
// Insufficient funds
}
Check balances across different currencies: const currencies = [ 'USD' , 'BRL' , 'EUR' ];
const balances = await Promise . all (
currencies . map ( currency =>
getBalance ( merchantId , { currency })
)
);
Track the reserve balance to ensure compliance with reserve requirements: const balance = await getBalance ( merchantId );
if ( balance . reserve_balance < requiredReserve ) {
// Alert: Reserve below threshold
}
Error Handling
Invalid Currency
When an invalid currency is provided, the API returns a 200 status with zeroed values:
{
"balance" : 0 ,
"available_balance" : 0 ,
"reserve_balance" : 0
}
No Accounts
When the merchant has no accounts, the API returns a 200 status with zeroed values:
{
"balance" : 0 ,
"available_balance" : 0 ,
"reserve_balance" : 0
}
Best Practices
Cache Balance Data : Balance information doesn’t change frequently. Consider caching the response for a short period (e.g., 1-5 minutes) to reduce API calls.
Check Available Balance : Always use available_balance rather than balance when determining if funds are available for transactions, as balance includes reserved amounts.