Global Balance
To get the merchant balance of all country codes by currency in the NoWallet system, use the following endpoint:
{baseUrl}/check/transactions/global/balances/{currency}The currency parameter in the URL is the currency code for which you want to check the balance. For example, XAF for Central African Franc.
Request Parameters
When checking the balance, the request must include the following parameters in the URL:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| currency | path | string | true | balances currency will be checked |
Code Samples in Multiple Languages
To help you integrate the NoWallet API seamlessly, we provide code samples in various programming languages. These examples demonstrate how to make a request to the API endpoint and handle the response.
- Shell (cURL): For quick testing and command-line usage.
- HTTP: Raw HTTP request format for understanding the structure.
- JavaScript: Using
fetchfor browser or Node.js environments. - Ruby: Using the
rest-clientlibrary for Ruby applications. - Python: Using the
requestslibrary for Python projects. - PHP: Using
GuzzleHttpfor PHP integrations. - Java: Using
HttpURLConnectionfor Java applications. - Go: Using the
net/httppackage for Go projects.
Example Request
Below is an example of how to check the balance of all country codes by currency using different languages. Select the tab corresponding to your preferred language to view the implementation.
Ensure you replace {access-token} with your actual API token and provide the required request parameters.
- cURL
- HTTP
- JavaScript
- Ruby
- Python
- PHP
- Java
- Go
# Example cURL command to get global balance
curl -X GET {baseUrl}/check/transactions/global/balances/{currency} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET {baseUrl}/check/transactions/global/balances/{currency} HTTP/1.1
Accept: application/json
const headers = {
Accept: "application/json",
Authorization: "Bearer {access-token}",
};
fetch("{baseUrl}/check/transactions/global/balances/{currency}", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get '{baseUrl}/check/transactions/global/balances/{currency}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('{baseUrl}/check/transactions/global/balances/{currency}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','{baseUrl}/check/transactions/global/balances/{currency}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("{baseUrl}/check/transactions/global/balances/{currency}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "{baseUrl}/check/transactions/global/balances/{currency}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Response Parameters
The response from the API will include the balance information for all country codes by currency. The structure of the response will depend on the specific implementation.
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | global balance infos fetched successfully for currency | ResponseGlobalBalanceDto |
| 400 | Bad Request | Bad Request possible errors | None |
Response Types
The response will be in JSON format.
Success Response (200 OK)
Example of a successful response with balance informations.
{
"bglobal": {
"balance": 200,
"deposit": 140,
"withdrawal": 60,
"potentialBalance": 100,
"possibleWithdrawal": 100,
"update": "2025-01-01TZ00:00:00"
},
"bcountry": [
{
"balance": 200,
"deposit": 150,
"withdrawal": 60,
"potentialBalance": 100,
"possibleWithdrawal": 100,
"update": "2025-01-01TZ00:00:00"
}
]
}
Error Response (400 Bad Request)
Bad Request possible errors
{
"statusCode": 400,
"error": "CURRENCY_NOT_FOUND",
"message": "It seems that this currency does not exist or You can't perform this action, this token does not allow you"
}
Was this page helpful?