Mobile Money Collection API
Environment: Live
Collect payments via mobile money USSD prompt.
# Mobile Money Collection API
Send a USSD payment request to a payer's phone number for approval.
## Endpoint
- **Method**: POST
- **URL**: https://api.moolre.com/open/transact/payment
## Headers
| Header | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| X-API-USER | string | Yes | Your Moolre username. |
| X-API-PUBKEY | string | Yes | Your Public API Key. |
| Idempotency-Key | string | No | Optional. 1 to 128 printable characters. Repeating the request with the same key and body returns the stored response (with meta.replayed true) for 24 hours; a different body returns IDEM01. See Idempotency. |
## Request Body
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| type | integer | Yes | Must be 1. |
| channel | string | Yes | Channel name: MTN, TELECEL or AT. The numeric ids 13 (MTN), 6 and 7 still work but are deprecated and return a notice. |
| currency | string | Yes | Currency code: GHS (Ghana Cedis) or NGN (Nigerian Naira). |
| payer | string | Yes | Customer's phone number. Use the local 0-prefixed format. |
| amount | string | Yes | Amount to collect. Must be greater than 0. |
| externalref | string | Yes | Unique reference for the payment. |
| otpcode | string | No | OTP code if required by the flow. |
| reference | string | No | Optional payment reference. |
| sessionid | string | No | USSD session ID if applicable. |
| accountnumber | string | Yes | Your Moolre Account Number. |
| skipotp | boolean | No | Sandbox only. Set true to skip OTP simulation; defaults to false. |
## Response (200 (OTP Required) OTP Required)
Payment requires phone number verification.
```json
{
"status": 1,
"code": "TP14",
"message": "Please complete the verification process sent to you via SMS and try again.",
"data": "all",
"go": null,
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Response (200 (Payment Request) Success)
Payment request initiated successfully.
```json
{
"status": 1,
"code": "TR099",
"message": null,
"data": "f25fc80e-791b-495b-8799-dcf87660457d",
"go": null,
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Response (400 Duplicate Reference)
The external reference must be unique.
```json
{
"status": "0",
"code": "TP13",
"message": "External Reference is required and must be unique.",
"data": "externalref",
"go": null,
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Fields every response can carry
These fields are additive: existing fields keep their names, order and types.
| Field | Meaning |
| :--- | :--- |
| meta | Always present, last in the object. meta.replayed is true only when the response is the stored answer to a repeated Idempotency-Key (absent otherwise). meta.requestid is the unique id of the request (also the X-Request-Id response header): quote it when you contact support. meta.notices is always an array, empty when there is nothing to report; each notice is { code, message, docs? }, for example that a deprecated way of sending credentials was used. See [Deprecations](https://docs.moolre.com/guides/deprecations). |
There is no outcome field. Decide the result from status, code and, on payment and transfer endpoints, data.txstatus (0 pending, 1 succeeded, 2 failed). These codes mean the result is unknown and may still succeed, so treat them as pending and check the status: PY01, PY02, TR01, TR02, TP11, TP18, APY10, APY16, ASL06, IS30, SYS500. Status 1 with TR08, OBGH01, OTGH01, OBNG01, GHQ03 or OM03 is final success; any other status 1 is an accepted, unfinished request.
Send X-Moolre-Http-Status: strict to receive real HTTP status codes (400, 401, 403, 404, 409, 422, 429, 5xx) instead of HTTP 200. See [Responses and request IDs](https://docs.moolre.com/guides/responses).