The meCash Docs is live ๐ŸŽ‰ ๐ŸŽ‰
Wallets
Get All Wallets

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

ParameterTypeDescriptionRequiredExample Value
currencyStringThe currency code for the wallet (ISO 4217)โœ… YesNGN
countryStringThe country code (ISO 3166-1 alpha-2)โœ… YesNG

Headers

HeaderDescriptionRequiredExample Value
x-api-keyAPI key for authenticationโœ… YesAPI_KEY_SANDBOX:Zg0hBvVl.Ra!MS.XS$H5QGEqhbASpBPn49fl08!qHYuPh7U5MeGFzAyMBj8!R1ir
Content-TypeThe content type of the requestโœ… Yesapplication/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

FieldTypeDescription
messageStringConfirmation message indicating success
statusStringIndicates success or failure

Data Details

FieldTypeDescription
idStringUnique identifier for the wallet
balanceNumberWallet balance
currencyStringCurrency code (e.g., NGN)
countryStringCountry code (e.g., NG)

Key Takeaways

  • The user can fetch the wallet balance by providing the currency and country 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 CodeMeaningExample Response
400Bad Request{ "message": "Invalid parameters" }
401Unauthorized{ "message": "Invalid API key" }
404Not Found{ "message": "Wallet not found" }
500Internal Server Error{ "message": "An internal error occurred" }