Mobile Money (with OTP Flow - GHS Only)
Use the OTP flow when you want an extra check that the person paying owns the Mobile Money number being debited. When it is switched on, OGateway sends the customer a one-time code (OTP) by SMS before the debit is sent to the network. Your platform collects that code from the customer and submits it to OGateway. The debit continues only after the code has been verified.
AvailabilityThe OTP flow is available for GHS Mobile Money collections only. Once it is enabled, it applies to every GHS Mobile Money collection on your business account. Collections in other currencies are not affected.
SMS chargesAn SMS fee applies to each OTP sent. The amount is shown in
metadata.smsFeeon the collection response.
Base URL
https://api.ogateway.io
Authentication
All requests must include your API key in the Authorization header:
Authorization: your_api_key
How it works
- A team member turns on Send SMS OTP when collecting payments in the merchant dashboard (one-time setup).
- Your platform calls
POST /collections/mobilemoneyas normal. - OGateway sends the customer an SMS with an OTP and returns the transaction with
status: "OTP". - Your platform shows an input field where the customer enters the OTP.
- Your platform submits the OTP to
POST /collections/otp. When the code is accepted, the transaction moves tostatus: "INITIATED". - From here the flow continues like a standard Mobile Money collection. The customer approves the debit on their phone and OGateway sends the final status (
COMPLETEDorFAILED) to yourcallbackURL.
Sequence flow
sequenceDiagram
autonumber
actor C as Customer
participant M as Merchant Platform
participant O as OGateway API
participant T as Mobile Money Network
Note over M,O: One-time setup: Settings → Business → Security →<br/>"Send SMS OTP when collecting payments (Only GHS)"
C->>M: Checkout, enters Mobile Money number
M->>O: POST /collections/mobilemoney
O-)C: SMS with one-time code (OTP)
O-->>M: 200 OK · status: "OTP" (id, metadata.otpExpiresAt)
M->>C: Show OTP input field
C->>M: Enters OTP from SMS
M->>O: POST /collections/otp { id, otp }
O-->>M: 200 OK · status: "INITIATED"
O->>T: Debit request
T-)C: Approval prompt on phone
C->>T: Approves with Mobile Money PIN
T-->>O: Debit result
O-)M: Webhook to callbackURL · status: "COMPLETED" or "FAILED"
M->>C: Payment confirmation
Step 1: Enable SMS OTP in the dashboard
- Log in to the OGateway merchant dashboard.
- Go to Settings → Business.
- In the Security section, tick Send SMS OTP when collecting payments (Only GHS).
- Click Save.
Step 2: Initiate the collection
Call the Mobile Money collection endpoint exactly as you would without OTP. The request body does not change.
Endpoint: POST /collections/mobilemoney
Headers
| Header | Value |
|---|---|
Authorization | your_api_key |
Content-Type | application/json |
Request
curl --request POST \
--url https://api.ogateway.io/collections/mobilemoney \
--header 'Authorization: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"amount": 2,
"currency": "GHS",
"network": "VOD",
"accountName": "Kwame Mensah",
"accountNumber": "0201234567",
"reason": "Order #10234",
"reference": "order_10234",
"callbackURL": "https://yourdomain.com/webhooks/"
}'Step 3: Handle the OTP status
OTP statusWith SMS OTP enabled, the response comes back with status: "OTP" instead of INITIATED. At this point an SMS containing the OTP has been sent to the customer's phone. No debit has been sent to the network yet.
Response: 200 OK
{
"id": "13d19fcf-cf98-4f62-911d-344e95123456",
"amount": 2,
"fee": 0,
"currency": "GHS",
"status": "OTP",
"channel": "MOMO",
"type": "DEBIT",
"customer": {
"accountName": "Kwame Mensah",
"accountNumber": "0201234567"
},
"metadata": {
"smsFee": 0.05,
"otpExpiresAt": "2026-11-17T17:01:11.724Z"
},
"reason": "Order #10234",
"network": "VOD",
"checkout_url": null,
"provider_message": "",
"reference_business": "order_10234",
"created_at": "2026-11-17T16:51:11.707Z",
"updated_at": "2026-11-17T16:51:11.728Z",
"virtual_account": null,
"message": null,
"telco_response": null,
"instructions": null,
"bear_fee": "customer"
}Fields to note:
| Field | What to do with it |
|---|---|
id | Store it. You need it to submit the OTP in Step 5. |
status | OTP means the customer must enter the code before the collection can continue. |
metadata.otpExpiresAt | The time (UTC) after which the OTP is no longer valid. In this example, 10 minutes after created_at. |
metadata.smsFee | The SMS charge for sending the OTP. |
Build for both statusesBranch on
statusrather than assuming one flow. If the response isOTP, show the OTP input (Step 4). If it isINITIATED, SMS OTP is not active for this transaction, so skip straight to waiting for the webhook.
Step 4: Collect the OTP from the customer
Your checkout must give the customer a place to enter the code they received. We recommend that you:
- Tell the customer that a verification code has been sent by SMS to the number they entered.
- Provide a single input field for the code (the code in our example is 6 digits).
- Show a countdown or expiry message based on
metadata.otpExpiresAt. - Keep the transaction
idfrom Step 3 tied to the checkout session so you can submit the code against it.
Step 5: Submit the OTP
Endpoint: POST /collections/otp
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The transaction id returned by /collections/mobilemoney. |
otp | string | Yes | The code the customer received by SMS and entered on your page. |
Request
curl --request POST \
--url https://api.ogateway.io/collections/otp \
--header 'Authorization: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"id": "13d19fcf-cf98-4f62-911d-344e95123456",
"otp": "000000"
}'Response: 200 OK
When the OTP is valid, the transaction moves to status: "INITIATED" and the debit request is sent to the Mobile Money network.
{
"id": "13d19fcf-cf98-4f62-911d-344e95123456",
"amount": 2,
"fee": 0,
"currency": "GHS",
"status": "INITIATED",
"channel": "MOMO",
"type": "DEBIT",
"customer": {
"accountName": "Kwame Mensah",
"accountNumber": "0201234567"
},
"metadata": {
"smsFee": 0.05,
"otpExpiresAt": "2026-11-17T17:01:11.724Z"
},
"reason": "Order #10234",
"network": "VOD",
"checkout_url": null,
"provider_message": "",
"reference_business": "order_10234",
"created_at": "2026-11-17T16:51:11.707Z",
"updated_at": "2026-11-17T16:58:01.468Z",
"virtual_account": null,
"message": null,
"telco_response": null,
"instructions": null,
"bear_fee": "customer"
}Step 6: Wait for the final status
INITIATED is not a final status. After the OTP is accepted, the customer receives the usual Mobile Money approval prompt on their phone and approves the debit with their PIN. OGateway then sends a webhook to your callbackURL with the final status:
| Status | Meaning |
|---|---|
COMPLETED | The customer approved the debit and the funds were collected. |
FAILED | The debit did not go through. Check message, telco_response and instructions for the reason and next steps. |
The webhook payloads are the same as for a standard Mobile Money collection. See the Success and Failed callback examples in Mobile Money Collection.
Always use the webhook for the final statusDo not mark an order as paid when you receive
INITIATED. Wait for theCOMPLETEDwebhook. If no webhook arrives within about 5 minutes, query the transaction byidinstead of starting a new charge.
Statuses in the OTP flow
| Status | Returned by | Meaning |
|---|---|---|
OTP | POST /collections/mobilemoney | The OTP has been sent to the customer by SMS. Waiting for your platform to submit the code. |
INITIATED | POST /collections/otp | The OTP was accepted. The debit has been sent to the network for customer approval. |
COMPLETED | Webhook | Payment successful. |
FAILED | Webhook | Payment unsuccessful. |
Best practices
- Store the transaction
idfrom the first response. Without it you cannot submit the OTP. - Respect the expiry. Prompt the customer to enter the code before
metadata.otpExpiresAt. - Never log or store the OTP after you have submitted it.
- Use a unique
referencefor every collection, including when a customer starts the payment again. - Tell customers what to expect: first an SMS with a code, then a Mobile Money approval prompt asking for their PIN.
Updated 16 days ago