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.

📘

Availability

The 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 charges

An SMS fee applies to each OTP sent. The amount is shown in metadata.smsFee on 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

  1. A team member turns on Send SMS OTP when collecting payments in the merchant dashboard (one-time setup).
  2. Your platform calls POST /collections/mobilemoney as normal.
  3. OGateway sends the customer an SMS with an OTP and returns the transaction with status: "OTP".
  4. Your platform shows an input field where the customer enters the OTP.
  5. Your platform submits the OTP to POST /collections/otp. When the code is accepted, the transaction moves to status: "INITIATED".
  6. 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 (COMPLETED or FAILED) to your callbackURL.

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

  1. Log in to the OGateway merchant dashboard.
  2. Go to Settings → Business.
  3. In the Security section, tick Send SMS OTP when collecting payments (Only GHS).
  4. Click Save.
📘

To switch the OTP flow off, untick the same checkbox and 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

HeaderValue
Authorizationyour_api_key
Content-Typeapplication/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

With 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:

FieldWhat to do with it
idStore it. You need it to submit the OTP in Step 5.
statusOTP means the customer must enter the code before the collection can continue.
metadata.otpExpiresAtThe time (UTC) after which the OTP is no longer valid. In this example, 10 minutes after created_at.
metadata.smsFeeThe SMS charge for sending the OTP.
👍

Build for both statuses

Branch on status rather than assuming one flow. If the response is OTP, show the OTP input (Step 4). If it is INITIATED, 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 id from 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

ParameterTypeRequiredDescription
idstringYesThe transaction id returned by /collections/mobilemoney.
otpstringYesThe 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:

StatusMeaning
COMPLETEDThe customer approved the debit and the funds were collected.
FAILEDThe 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 status

Do not mark an order as paid when you receive INITIATED. Wait for the COMPLETED webhook. If no webhook arrives within about 5 minutes, query the transaction by id instead of starting a new charge.


Statuses in the OTP flow

StatusReturned byMeaning
OTPPOST /collections/mobilemoneyThe OTP has been sent to the customer by SMS. Waiting for your platform to submit the code.
INITIATEDPOST /collections/otpThe OTP was accepted. The debit has been sent to the network for customer approval.
COMPLETEDWebhookPayment successful.
FAILEDWebhookPayment unsuccessful.

Best practices

  • Store the transaction id from 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 reference for 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.

Did this page help you?