Withdraw
Send funds from your company wallet to a Rwanda mobile-money or bank account using the Weflexfy withdrawal API. Check the balance and fee, submit a withdrawal, then receive its final result through your company webhook.
Company setup & authentication
In the dashboard, open Companies → Integration for your company to generate its access key and secret key and save your webhook URL. The company must be active, approved, and wallet enabled, with a linked company wallet.
Use your company access key in the access_key header. App keys used for payment collection do not authorize wallet withdrawals. Keep both company keys on your server.
Base URL: https://api.weflexfy.com
access_key: YOUR_COMPANY_ACCESS_KEY
Content-Type: application/json1. Check balance and fee
GET /api/v1/vendor/wallet/balancecurl 'https://api.weflexfy.com/api/v1/vendor/wallet/balance' \
-H 'access_key: YOUR_COMPANY_ACCESS_KEY'Example response (HTTP 200):
{
"currency": "RWF",
"balance": 25000,
"disbursementFeeAmount": 100
}The fee is a fixed company disbursement fee. A 5,000 RWF withdrawal with a 100 RWF fee deducts 5,100 RWF from the wallet; the recipient receives 5,000 RWF.
2. Initiate a withdrawal
POST /api/v1/vendor/wallet/withdrawcurl -X POST 'https://api.weflexfy.com/api/v1/vendor/wallet/withdraw' \
-H 'access_key: YOUR_COMPANY_ACCESS_KEY' \
-H 'Content-Type: application/json' \
-d '{
"amount": 5000,
"destinationProvider": "MTN",
"phoneNumber": "0781234567",
"requestId": "7e0ff13c-a503-49c4-916d-4a7ee0a2f975",
"expectedFeeAmount": 100
}'Supported destination operators
Set destinationProvider to one of: MTN, AIRTEL, BK, EQUITY, GTBANK, I&M, BOA, BPR, ECOBANK, ACCESS, COGEBANQUE, BRD, AB BANK, or UNGUKA. Each request targets one recipient at one operator through our API. If you omit the provider, we identify the mobile-money operator from the phone number.
We verify the recipient name internally before debiting your wallet. Lookup failure or a provider/account mismatch rejects the request without debiting. Temporary lookup transport failures return HTTP 503; retry with the same request ID. Already accepted retries return the existing withdrawal without another lookup. The account or phone number must match the selected operator. Use provider codes exactly as listed.
Bank withdrawal example
{
"destinationProvider": "BK",
"phoneNumber": "0012345678",
"amount": 5000,
"expectedFeeAmount": 100,
"requestId": "b3c00d76-b7be-4c05-8d3f-11620db67afa"
}amount: required JSON number; a whole amount from 500 to 10,000,000 RWF.phoneNumber: required recipient string. For MTN use 078/079; for AIRTEL use 072/073. Local or 250/+250 format is accepted without spaces. For banks, send the bank account number in this same field, preserving leading zeros. Bank accounts allow 1–40 letters, digits, hyphens, underscores, dots, or plus signs.requestId: required UUID v4. Generate and save one per withdrawal on your server, for example withcrypto.randomUUID().expectedFeeAmount: the fee from the balance response, as a JSON number. Required when the configured fee is greater than zero; send it even when zero to confirm the total. If the fee changes, refresh the balance and confirm the new total before resubmitting.
Example accepted response (HTTP 201; reference shown as a placeholder):
{
"disbursementId": 123,
"disbursementRef": "<returned-withdrawal-reference>",
"status": "PENDING"
}Funds and fees are reserved when the request is accepted. PENDING means queued, not paid. The payout may then be WAITING_FOR_SETTLEMENT; final API statuses are COMPLETED and FAILED. A confirmed failed withdrawal refunds both the amount and its fee.
Retry safely
If the request times out, retry with the same requestId, amount, provider, and recipient details. The same request returns the existing withdrawal instead of debiting again. Reusing an ID with a different amount, provider, or recipient is rejected. Save the returned disbursementRef to match webhook results; it is different from your requestId.
Validation & errors
- 400 Bad Request: invalid amount, phone or UUID; conflicting request ID; changed fee; insufficient balance for amount plus fee; or unavailable wallet/fee configuration.
- 401 Unauthorized: missing or invalid company access key.
- 403 Forbidden: company is inactive, unapproved, or wallet disabled.
- 404 Not Found: the company has no linked wallet.
Read the response message for details. A balance check does not reserve funds; the withdrawal rechecks funds and fees. You cannot select another company or wallet through the request body.
3. Receive the final result
Final success or failure is posted to your company's configured webhook URL. The JSON envelope matches payment webhooks, with a different request type:
{
"token": "<signed JWT>",
"requestType": "withdrawal"
}Verify the token on your server with the company secret key and allow only HS256. Do not merely decode it. Tokens expire after one hour. The verified claims include:
{
"disbursementRef": "<returned-withdrawal-reference>",
"status": "SUCCESS",
"iat": 1790000000,
"exp": 1790003600
}Webhook status is SUCCESS for a completed payout or FAILED for a confirmed failure. These are final outcomes; pending withdrawals do not send a final-result webhook.
Node.js verification example
import jwt from 'jsonwebtoken';
// Inside your server's POST webhook handler:
if (req.body.requestType !== 'withdrawal') {
return res.sendStatus(400);
}
try {
const claims = jwt.verify(
req.body.token,
process.env.COMPANY_SECRET_KEY,
{ algorithms: ['HS256'] }
);
if (typeof claims === 'string' ||
typeof claims.disbursementRef !== 'string' ||
!['SUCCESS', 'FAILED'].includes(claims.status)) {
return res.sendStatus(400);
}
// Match a saved withdrawal and persist its outcome atomically.
// Deduplicate by disbursementRef before applying business effects.
await saveWithdrawalOutcomeOnce(claims.disbursementRef, claims.status);
return res.sendStatus(200);
} catch {
return res.sendStatus(400);
}The example uses jsonwebtoken; implement saveWithdrawalOutcomeOnce with your database. Return a 2xx response after saving the result. Delivery is checked every 30 seconds and failed attempts retry. Missing company webhook URL or secret keeps notifications pending. A timeout after receipt may cause duplicate delivery, so process each reference idempotently.