Single Balance
To get the merchant balance of a single country code in the NoWallet system, use the following endpoint:
{baseUrl}/check/transactions/single/balances/{country}The country parameter in the URL is the country code for which you want to check the balance. For example, CM for Cameroon.
Request Parameters
When checking the balance, the request must include the following parameters in the URL:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| country | path | string | true | balance country code 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 a single country code 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 single balance
curl -X GET {baseUrl}/check/transactions/single/balances/{country} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET {baseUrl}/check/transactions/single/balances/{country} HTTP/1.1
Accept: application/json
const headers = {
Accept: "application/json",
Authorization: "Bearer {access-token}",
};
fetch("{baseUrl}/check/transactions/single/balances/{country}", {
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/single/balances/{country}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('{baseUrl}/check/transactions/single/balances/{country}', 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/single/balances/{country}', 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/single/balances/{country}");
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/single/balances/{country}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Response Parameters
When you make a request to the NoWallet API to check the balance of a single country code, you will receive a response containing the balance information. The response will be in JSON format and will include details such as the total deposit, withdrawal amounts, and other relevant information.
The response from the API will include the balance information for the specified country code. The structure of the response may vary based on the implementation, but it typically includes fields such as:
- country: The country code for which the balance is being checked.
- deposit: The total deposit amount in the specified currency.
- withdrawal: The total withdrawal amount in the specified currency.
- message: Any additional information or error messages related to the request.
- statusCode: The status code of the response, indicating success or failure (e.g., 200 for success, 400 for bad request).
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | all infos for this balance fetched successfully | ResponseSingleBalanceDto |
| 400 | Bad Request | Bad Request possible errors | None |
Response Types
When you make a request to the NoWallet API to check the balance of a single country code, you will receive a response containing the balance information. The response will be in JSON format and will include details such as the total deposit, withdrawal amounts, and other relevant information.
The response will be in JSON format.
Success Response (200 OK)
Example of a successful response with balance informations.
{
"balance": 200,
"deposit": 140,
"withdrawal": 60,
"potentialBalance": 100,
"possibleWithdrawal": 100,
"update": "2025-01-01TZ00:00:00"
}
Error Response (400 Bad Request)
Bad Request possible errors
{
"statusCode": 400,
"error": "COUNTRY_CODE_NOT_FOUND",
"message": "It seems that this country code does not exist or You can't perform this action, this token does not allow you"
}
Was this page helpful?