Merchant Payin (Collect Payment)
Collect payments from customers via mobile money.
Note: Currently, only mobile money payment method is supported for payin transactions.
Endpoint
POST /api/v1/merchant/payin
Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | ✅ | Bearer token with your merchant API key |
| Content-Type | string | ✅ | application/json |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | number | ✅ | The amount to collect from the customer. Must be at least 0.1, and within the minimum/maximum of the network (see Transaction Limits) |
| currency | string | ✅ | 3-letter ISO currency code (e.g., XOF, GHS, KES) |
| payment_method | string | ✅ | Payment method to use. Currently only supports: mobile_money |
| order_id | string | Your internal order/transaction reference ID (max 255 characters) | |
| callback_url | string | URL where payment status updates will be sent (webhook URL). If provided, overrides the default webhook URL in your dashboard. | |
| metadata | object | ✅ | Additional payment information (required for mobile_money) |
| metadata.network | string | ✅ | Mobile money network (e.g., mtn, orange, moov, vodafone, tigo, airtel, mpesa, afrimoney). See network detection |
| metadata.phone_number | string | ✅ | Customer phone number for mobile money |
| metadata.country_code | string | ✅ | 2-letter ISO country code (e.g., BF, GH, KE, CD) |
| metadata.om_otp | string | OTP authorization code (optional). For networks that require OTP (see table below), provide the customer's OTP here for immediate processing. |
Network detection
The network is normally detected from the phone number prefix, and the detected network is the one used even if metadata.network says otherwise. metadata.network is decisive only for networks without phone prefixes (e.g. wave, aps) and in countries where operators share prefixes (e.g. Benin). Always send the network that matches the customer's number.
Amount rounding: For transactions in certain countries (BF, BJ, CI, CM, GN, ML, TG), the amount may be automatically rounded to the nearest multiple of 5 to meet local processing requirements. The response always reflects the actual processed amount.
Example Request
curl -X POST "https://dashboard.mbiyo.africa/api/v1/merchant/payin" \
-H "Authorization: Bearer YOUR_MERCHANT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"currency": "XOF",
"payment_method": "mobile_money",
"order_id": "ORDER-12345",
"callback_url": "https://yourdomain.com/webhook/payment-status",
"metadata": {
"network": "orange",
"phone_number": "+22670123456",
"country_code": "BF",
"om_otp": "123456"
}
}'
The om_otp field is optional and only applicable for networks that require OTP (see supported networks table below).
Success Response (200 OK)
{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"transaction_id": "CI-66F3A1B2C4D5E1727258400A1B2",
"amount": 1000,
"fee": 15,
"charged_amount": 1000,
"currency": "XOF",
"order_id": "ORDER-12345",
"status": "pending",
"redirect_url": null,
"instructions": null,
"auth_mode": null,
"created_at": "2025-12-16T10:30:00Z"
}
}
Amounts:
amountis what the customer pays.feeis the Mbiyopay fee, deducted from the amount credited to your balance. For a payin,charged_amountis always equal toamount(the fee is never added to what the customer pays).
Important: Check the
auth_modefield to determine the next step:
- auth_mode = null — Standard flow. Wait for webhook.
- auth_mode = "confirm" — Confirmation is handled automatically. Show the
instructionsto the user and wait for webhook.- auth_mode = "pin" — Collect the PIN/OTP from the customer and call the Finalize endpoint.
- redirect_url present — Redirect the customer to this URL to complete the payment externally.
When
redirect_urlis present it takes precedence: always redirect the customer to it, even ifauth_modeis also set.
Wave (CI / SN / GM) — External Redirect
Wave is an external-authorization network. The payin response contains a Wave checkout link in redirect_url:
{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"transaction_id": "CI-66F3A1B2C4D5E1727258400A1B2",
"amount": 1000,
"fee": 30,
"charged_amount": 1000,
"currency": "XOF",
"order_id": "ORDER-67890",
"status": "pending",
"redirect_url": "https://pay.wave.com/c/cos-xxxxxxxx?a=1000&c=XOF&m=MbiyoPay",
"created_at": "2025-12-16T10:30:00Z"
}
}
When redirect_url is present, send the customer to that URL to complete the payment. The final status is delivered asynchronously via webhook. This applies to Wave in Côte d'Ivoire (CI), Senegal (SN) and Gambia (GM).
Gambia (GM) — Additional Response Fields
For mobile money networks in Gambia (GM), the response may include additional fields:
- instructions — HTML content from the telecom operator to display to the user
- auth_mode — Determines the next step to complete the payment
Rendered instructions preview
When auth_mode is "confirm" and instructions contains HTML, it renders as:
You can confirm your Afrimoney payment using either of the two methods below:
- Via the Afrimoney App: Open the Afrimoney app on your phone and follow the prompts to approve the payment.
- Using a Dial Code (USSD):
- Dial *777*7*3*[Your PIN]# on your phone
- Select the Transaction from the menu
- Choose option 1 to Confirm the transaction
Once you've completed the steps, return to this page to confirm your payment.
Response with Confirmation Instructions (Afrimoney)
{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"transaction_id": "CI-6789ABCDEF12345",
"amount": 100,
"fee": 2,
"charged_amount": 100,
"currency": "GMD",
"order_id": "ORDER-99999",
"status": "pending",
"redirect_url": null,
"instructions": "<p>You can confirm your Afrimoney payment using either of the two methods below:</p><ol><li><strong>Via the Afrimoney App:</strong><br/>Open the Afrimoney app on your phone and follow the prompts to approve the payment.</li><li><strong>Using a Dial Code (USSD):</strong><ul><li>Dial <strong>*777*7*3*[Your PIN]#</strong> on your phone</li><li>Select the <strong>Transaction</strong> from the menu</li><li>Choose option <strong>1</strong> to <strong>Confirm</strong> the transaction</li></ul></li></ol><p>Once you've completed the steps, return to this page to confirm your payment.</p>",
"auth_mode": "confirm",
"created_at": "2026-04-15T20:07:08Z"
}
}
When auth_mode is "confirm", display the instructions (HTML) to the user so they know how to approve the payment on their phone. Then wait for the webhook.
Response with PIN Required (QMoney / APS)
{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"transaction_id": "CI-ABCDEF1234567890",
"amount": 50,
"fee": 1,
"charged_amount": 50,
"currency": "GMD",
"order_id": "ORDER-88888",
"status": "pending",
"redirect_url": null,
"instructions": null,
"auth_mode": "pin",
"created_at": "2026-04-15T20:07:08Z"
}
}
When auth_mode is "pin", collect the OTP/PIN from the customer and call the Finalize Payment endpoint to complete the transaction.
Error Responses
422 — Validation error
Returned when a parameter is missing or malformed.
{
"status": "error",
"message": "Validation failed",
"data": {
"amount": [
"The amount field is required."
],
"metadata.phone_number": [
"The metadata.phone_number field is required when payment method is mobile_money."
]
}
}
400 — Payment cannot be routed
Returned when the request is valid but cannot be processed: unsupported country/currency/network, network temporarily unavailable or disabled for your account, amount outside the network limits, etc. The message explains the reason.
{
"status": "error",
"message": "Minimum XOF transaction amount for orange is 500.",
"data": null
}
Examples of messages: Payment method not supported for BF/mobile_money, Currency USD not supported for BF/mobile_money, Invalid phone number or unsupported network for BF/mobile_money, Payin is temporarily disabled for orange.
200 — Initiation failed
If the operator rejects the request, the transaction is still created (so you get a transaction_id) but with "status": "error" at the top level and a failed transaction status. Always check the top-level status, not only the HTTP code.
{
"status": "error",
"message": "Transaction initiation failed",
"data": {
"transaction_id": "CI-66F3A1B2C4D5E1727258400A1B2",
"amount": 1000,
"fee": 15,
"currency": "XOF",
"order_id": "ORDER-12345",
"status": "failed",
"charged_amount": 1000,
"instructions": null,
"auth_mode": null,
"redirect_url": null,
"created_at": "2025-12-16T10:30:00Z"
}
}
Payment Status
| Status | Description |
|---|---|
| pending | Payment has been initiated and is waiting for customer confirmation |
| successful | Payment has been completed successfully |
| failed | Payment has failed |
| cancelled | Payment has been cancelled |
Webhook Notification
When the payment status changes, we will send a POST request to your callback_url with the following payload:
{
"transaction_id": "CI-66F3A1B2C4D5E1727258400A1B2",
"amount": 1000,
"fee": 15,
"currency": "XOF",
"order_id": "ORDER-12345",
"status": "successful",
"charged_amount": 1000,
"type": "cashin",
"created_at": "2025-12-16T10:30:00Z",
"updated_at": "2025-12-16T10:35:00Z",
"metadata": {
"country_code": "BF",
"phone_number": "22670123456",
"network": "orange",
"om_otp": null
}
}
metadata echoes the payment details and may contain additional fields; ignore the ones you do not use.
Best Practice: Always verify the transaction status by calling the transaction status endpoint before crediting your customer account.
Callback URL Priority: If you provide a
callback_urlin your request, notifications will be sent to this URL. If nocallback_urlis provided, we will use the default webhook URL configured in your merchant dashboard settings.
Webhook Security: If you have configured a webhook secret in your dashboard, we will include a
Signatureheader with HMAC-SHA256 hash of the payload for verification.
Supported Networks by Country
| Country | Code | Currency | Networks | OTP Required |
|---|---|---|---|---|
| Burkina Faso | BF | XOF | orange, moov, coris | Orange: *144*4*6*AMOUNT# (replace AMOUNT with the transaction amount, e.g., *144*4*6*500# for 500 XOF) (replace AMOUNT with transaction amount) |
| Benin | BJ | XOF | mtn, moov, celtiis | - |
| Congo - Brazzaville | CG | XAF | mtn | - |
| Congo - Kinshasa | CD | USD/CDF | vodacom, airtel, orange, africell | - |
| Cameroon | CM | XAF | orange, mtn | - |
| Cote d'Ivoire | CI | XOF | orange, mtn, wave, moov | Orange: #144*82#; Wave: redirect_url (pay.wave.com) |
| Gambia | GM | GMD | afrimoney, qmoney, wave, aps | QMoney & APS: PIN required (auth_mode: pin); Wave: redirect_url (pay.wave.com) |
| Guinea | GN | GNF | orange, mtn | Orange: #144# (Opt 4→2) |
| Mali | ML | XOF | orange, moov | Orange: #144#77# |
| Senegal | SN | XOF | orange, free, wave | Orange: #144#391#; Wave: redirect_url (pay.wave.com) |
| Togo | TG | XOF | moov, togocom | - |
| Uganda | UG | UGX | mtn, airtel | - |
| Tanzania | TZ | TZS | vodacom, airtel, tigo, halotel | - |
| Kenya | KE | KES | safaricom, airtel | - |
| Rwanda | RW | RWF | mtn, airtel | - |
| Ghana | GH | GHS | mtn, vodafone, airtel, tigo | - |
| Nigeria | NG | NGN | mtn, airtel, glo, 9mobile | - |
| South Africa | ZA | ZAR | eft | - |
| Zambia | ZM | ZMW/USD | mtn, airtel, zamtel | - |
| Mozambique | MZ | MZN | vodacom, mpesa | - |
| Egypt | EG | EGP | wallet | - |
About OTP
Networks marked with USSD codes require customers to dial the code to generate an authorization code before payment. The OTP validation is handled automatically by the mobile operator. You will receive the final payment status via webhook.
Senegal Orange: The customer must dial
#144#391#on their phone before you initiate the payment. You must display this USSD code to the customer so they can authorize the transaction. Once they've dialed the code, proceed with the payin request. The OTP validation is handled automatically — no need to collect an OTP from the customer.
Transaction Limits
Each country and currency has minimum and maximum transaction amount limits enforced at the network level. Transactions exceeding these limits will be rejected with a 400 error.
| Country | Currency | Minimum | Maximum |
|---|---|---|---|
| DR Congo | USD | $0.10 | $2,500.00 |
| DR Congo | CDF | 40.00 | 5,000,000.00 |
| Benin | XOF | 50.00 | 1,500,000.00 |
| Cameroon | XAF | 50.00 | 1,500,000.00 |
| Burkina Faso | XOF | 500.00 | 1,500,000.00 |
| Cote d'Ivoire | XOF | 500.00 | 1,500,000.00 |
| Senegal | XOF | 500.00 | 1,500,000.00 |
| Togo | XOF | 500.00 | 1,500,000.00 |
| Congo - Brazzaville | XAF | 500.00 | 1,500,000.00 |
| Guinea | GNF | 500.00 | 1,500,000.00 |
| Mali | XOF | 500.00 | 1,500,000.00 |
| Gambia | GMD | 10.00 | 200,000.00 |
| Uganda | UGX | 500.00 | 5,000,000.00 |
| Tanzania | TZS | 500.00 | 5,000,000.00 |
| Kenya | KES | 10.00 | 70,000.00 |
| Rwanda | RWF | 100.00 | 5,000,000.00 |
| South Africa | ZAR | 10.00 | 50,000.00 |
| Egypt | EGP | 1.00 | 50,000.00 |