Agent Network
Cash-in and cash-out through geo-fenced field agents. Managed liquidity, commission ledger, real-time float monitoring — built for the Djiboutian last mile.
Two actor types
sk_ API key) and the Agent (the individual field operator, authenticated with a dedicated agent API key or the Meras Agent mobile app). Endpoints that require agent-level authentication are marked accordingly.How cash-in works
- 1
Customer hands cash to the agent
The customer presents their mobile number and the DJF amount they want loaded onto their wallet. - 2
Agent initiates the transaction
The agent posts to/v1/agents/transactionswithtype=cash_in, the customer'scustomer_msisdn(E.164), theamount_minor, theproviderrail, and an optional note. This triggers an OTP or USSD push to the customer's handset. - 3
Customer approves on their mobile wallet
The customer enters the OTP on their handset (Waafi / D-Money) or dials the USSD string. This authorises the credit to their wallet. - 4
Float debited, wallet credited
On customer approval, the agent's float balance is debited by the transaction amount, and the customer's mobile wallet is credited. The transaction record transitions tosucceeded. - 5
Webhook fires
agent_transaction.succeededfires to the merchant's registered webhook endpoint with the full transaction object, includingfloat_balance_afterso the merchant can monitor agent liquidity in real time.
How cash-out works
- 1
Customer requests cash from the agent
The customer presents their mobile number and the DJF amount they want to withdraw. - 2
Agent initiates the transaction
POST to/v1/agents/transactionswithtype=cash_out, the customer's MSISDN, the amount, and the provider. The customer receives an OTP or USSD push. - 3
Customer authorises the wallet debit
The customer approves via OTP or USSD. Their mobile wallet is debited for the requested amount. - 4
Agent pays out cash, float credited
On confirmation, the agent physically hands over the cash and their float balance is credited by the transaction amount. The transaction transitions tosucceeded. - 5
Commission accrues
The configured commission for this transaction type and amount is calculated and added to the agent's commission ledger. Commissions are paid out weekly via the merchant's batch payout schedule.
Endpoints
/v1/agents/transactionsInitiate a cash-in or cash-out transaction. Called by the agent.
/v1/agents/transactionsList agent transactions. Filter by type, status, agent, date range.
/v1/agents/transactions/{id}Retrieve a specific transaction and its current state.
/v1/agents/floatGet the current float balance for the authenticated agent.
/v1/agents/float/topupTop up an agent's float from the merchant balance. Merchant key required.
/v1/agents/commissionsList accrued commission entries for the authenticated agent.
Transaction parameters
| Name | Type | Description |
|---|---|---|
typerequired | enum | cash_in or cash_out. |
amount_minorrequired | integer | Amount in DJF minor units (DJF is zero-decimal). |
currencyrequired | ISO 4217 | Must be "DJF" for domestic agent transactions. |
customer_msisdnrequired | E.164 | Mobile number of the customer in E.164 format. |
provider | enum | waafi · dmoney · eab. Defaults to the agent\'s configured primary provider. |
notes | string | Free-text note visible to the merchant in the portal. Not shown to the customer. ≤255 chars. |
Float depletion
GET /v1/agents/float proactively and top up before depletion using POST /v1/agents/float/topup. You can also configure low-float alert thresholds in the merchant portal under Agent Settings.Commission structure
Commission rules are configured per-merchant in the portal (Settings → Agent Commissions). Two schemes are supported:
| Scheme | Description | Payout cadence |
|---|---|---|
| Percentage | A fixed percentage of the transaction amount, configured separately for cash-in and cash-out. | Weekly batch payout |
| Flat fee | A fixed DJF amount per transaction, regardless of transaction size. | Weekly batch payout |
Accrued commissions are visible in real time via GET /v1/agents/commissions. Each entry references the originating transaction ID. The weekly payout creates a po_ payout record and fires a payout.created webhook.
Example — cash-in transaction and float check
curl -X POST https://api.merashub.com/v1/agents/transactions \
-H "Authorization: Bearer ak_agent_..." \
-H "Content-Type: application/json" \
-d '{
"type": "cash_in",
"amount_minor": 5000,
"currency": "DJF",
"customer_msisdn": "+25377123456",
"provider": "waafi",
"notes": "Customer walked in 09:41"
}'{
"id": "atxn_01HZGP5QNRT7V9WX2YE4ZK8MA",
"type": "cash_in",
"status": "requires_action",
"amount_minor": 5000,
"currency": "DJF",
"provider": "waafi",
"customer_msisdn": "+25377123456",
"next_action": {
"type": "collect_otp",
"otp_length": 6
},
"created_at": "2026-05-25T09:41:00Z"
}curl https://api.merashub.com/v1/agents/float \ -H "Authorization: Bearer ak_agent_..."
{
"agent_id": "agt_01HZGK4MNPR5Q8RT3VW6XE7YL",
"currency": "DJF",
"balance_minor": 184500,
"last_topup_at": "2026-05-24T08:00:00Z",
"low_float_threshold_minor": 50000,
"below_threshold": false
}