Wallet API
v1.0
API Documentation
Essential Nigeria Wallet β Backend REST API
Base URL
https://api-ewallet.eroot.ng/api
Version
v1.0.0
Format
application/json
About this API
This is the backend API powering the Essential Nigeria e-wallet platform. It handles user authentication, dedicated virtual accounts via Paystack, peer-to-peer transfers, cooperative savings (Ajo), fixed deposits, voucher management, and webhook processing.
Authentication
Protected endpoints require a JWT Bearer token in the Authorization header.
Obtain a token via POST /login.
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGci...
JWT_TTL config value (default 60 minutes). On expiry the API returns 401 Token expired.
Error Codes
| Code | Meaning | Common Cause |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Missing required field or invalid parameter |
| 401 | Unauthorized | Missing, expired, or invalid JWT token |
| 403 | Forbidden | Action not permitted for this user |
| 404 | Not Found | Resource does not exist |
| 422 | Unprocessable Entity | Validation failed β check errors object |
| 500 | Internal Server Error | Unexpected server-side exception |
| 502 | Bad Gateway | Upstream Paystack API call failed |
{
"error": "Invalid credentials", // single error string
"errors": { // validation error map (422)
"email": ["The email field is required."],
"amount": ["The amount must be at least 1."]
},
"message": "Human-readable description"
}
Auth Endpoints
Customers
Dedicated Virtual Accounts
Transfers
Transfer Control
Balance sync, OTP management, and transfer finalization.
Beneficiaries
Savings
All savings endpoints are prefixed with /savings and require authentication.
Fixed Deposits
Prefix: /fixed-deposits. All endpoints require authentication.
Ajo (Cooperative Savings)
Ajo is a traditional Nigerian rotating savings system. A group of members each contribute a fixed amount every cycle; one member receives the entire pot per cycle.
Prefix: /ajo. All endpoints require authentication.
Vouchers
Vouchers are redeemable codes that credit a user's wallet. Types: fixed (flat NGN amount) or percentage (% of cart value).
Prefix: /vouchers. All endpoints require authentication.
Webhooks
Important β Webhook Security
All Paystack webhook requests include an x-paystack-signature header containing an HMAC-SHA512 signature. The webhook handler verifies this against your PAYSTACK_SECRET_KEY before processing.
Webhook Behaviour Summary
| Event | Action |
|---|---|
| charge.success (DVA) | Logs the deposit; balance is re-computed on next /balance call |
| transfer.success | Updates WalletTransaction status β success |
| transfer.failed | Updates WalletTransaction status β failed (TODO: notify user) |
| transfer.reversed | Updates WalletTransaction status β reversed (TODO: credit back wallet) |