Get Wallet API
The Get Wallet API fetches users wallets based on the specified currency and country parameters.
Endpoint
GET https://{{baseURL}}/v1/wallet?currency={currency}&country={country}
This API requires two query parameters: currency
and country
.
Query Parameters
Parameter | Type | Description | Required | Example Value |
---|---|---|---|---|
currency | String | The currency code for the wallet (ISO 4217) | โ Yes | NGN |
country | String | The country code (ISO 3166-1 alpha-2) | โ Yes | NG |
Headers
Header | Description | Required | Example Value |
---|---|---|---|
x-api-key | API key for authentication | โ Yes | API_KEY_SANDBOX:Zg0hBvVl.Ra!MS.XS$H5QGEqhbASpBPn49fl08!qHYuPh7U5MeGFzAyMBj8!R1ir |
Content-Type | The content type of the request | โ Yes | application/json |
Request Example
curl --location --request GET 'https://{{baseURL}}/v1/wallet?currency=NGN&country=NG' \
--header 'x-api-key: API_KEY_SANDBOX:Zg0hBvVl.Ra!MS.XS$H5QGEqhbASpBPn49fl08!qHYuPh7U5MeGFzAyMBj8!R1ir' \
--header 'Content-Type: application/json'
Sucessful Response Example (200k)
If the request is successful, the API returns the following JSON response:
response.json
{
"message": "wallets fetched successfully",
"status": "success",
"data": [
{
"id": "abd2de64-a226-4405-8731-7b42fd937914",
"balance": 23094071.00,
"currency": "NGN",
"country": "NG"
}
]
}
Response Breakdown
General Information
Field | Type | Description |
---|---|---|
message | String | Confirmation message indicating success |
status | String | Indicates success or failure |
Data Details
Field | Type | Description |
---|---|---|
id | String | Unique identifier for the wallet |
balance | Number | Wallet balance |
currency | String | Currency code (e.g., NGN) |
country | String | Country code (e.g., NG) |
Key Takeaways
- The user can fetch the wallet balance by providing the
currency
andcountry
query parameters. - The response includes the wallet balance along with the currency and country information.
- The API returns a 200 OK status if the wallet data is successfully retrieved.
Best Practices
โ
Include a valid x-api-key
in the request headers to authenticate the request.
โ
Ensure that the currency
and country
parameters are valid and correctly formatted.
โ
Handle potential errors in case the wallet data is not found or the request fails.
Error Handling
Status Code | Meaning | Example Response |
---|---|---|
400 | Bad Request | { "message": "Invalid parameters" } |
401 | Unauthorized | { "message": "Invalid API key" } |
404 | Not Found | { "message": "Wallet not found" } |
500 | Internal Server Error | { "message": "An internal error occurred" } |