Airtime API
Environment: Sandbox
Sell GHS airtime on MTN, Telecel, or AT from a wallet; minimum GHS 1.00, unique per-wallet reference, and pending/uncertain outcome handling.
# Airtime API
Send airtime to a recipient on MTN, Telecel, or AT, paid from the wallet identified by accountnumber. The amount is in Ghana cedis (GHS) and must be at least 1.00. Use a unique external reference per wallet for each new sale.
## Endpoint
- **Method**: POST
- **URL**: https://sandbox.moolre.com/open/sales/airtime
## Headers
| Header | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| Content-Type | string | Yes | Send application/json. |
| X-API-USER | string | Yes | Your Moolre username. |
| X-API-KEY | string | Yes | Your Private API Key for the paying wallet. |
## Request Body
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| type | integer | Yes | Airtime sale function. Must be 1. |
| channel | string | Yes | Recipient network: MTN, TELECEL, or AT. Legacy values are also accepted: 1=MTN, 6=Telecel, 7=AT. |
| receiver | string | Yes | Phone number receiving the airtime. |
| amount | string | Yes | Airtime amount in GHS. Minimum 1.00. |
| currency | string | Yes | Sale currency. Must be GHS. |
| accountnumber | string | Yes | Moolre wallet account number to pay for the airtime. |
| externalref | string | Yes | Unique reference per wallet for this sale. The API also accepts extid as an alternative field name; send only one. Examples and this form use externalref. |
| reference | string | No | Optional narration for the sale. |
## Response (200 In progress (ASL11))
The sale is in progress. This example is not confirmation of airtime delivery.
```json
{
"status": "1",
"code": "ASL11",
"message": "Airtime sale in progress, please check its status.",
"data": {
"txstatus": 0,
"receiver": "233240000000",
"transactionid": "Pending",
"externalref": "your-extid",
"amount": "1.00"
},
"go": null
}
```
## Before you begin
Before using the Airtime or Data Sales APIs, you must create a Sell on Our Platform Service in the Moolre App.
[Open the Moolre App](https://app.moolre.com/).
## Special payment pricing
Special payment pricing is available for businesses that want to sell airtime and data. Contact Moolre Support to request this pricing.
[Contact Moolre Support](mailto:hello@moolre.com?subject=Airtime%20and%20Data%20Sales%20pricing).
## Handle pending and uncertain sales
ASL11 means the sale is in progress, not that airtime has been delivered. ASL06 is an uncertain outcome: the sale may still have gone through. Check the sale status before retrying; do not generate a new external reference to resubmit a pending or uncertain sale.
Check the sale using /open/sales/status with type 1, the paying wallet accountnumber, idtype 1, and id set to the original externalref (or extid). Only sales belonging to that wallet are searched.
[Open Sales Status](https://docs.moolre.com/api/sales/status) for identifier types, recorded sale details, refunds, and outcome codes.
Other replies from the sales server are returned unchanged; handle unlisted codes without assuming delivery succeeded.
## Airtime application codes
These meanings are not HTTP status codes or guaranteed exact response messages.
| Code | Meaning | Next step |
| --- | --- | --- |
| ASL11 | Sale in progress; no final reply yet. | Check the sale status before treating the top-up as complete or submitting again. |
| ASL00 | Authentication error. | Check the API user and private API key for the wallet. |
| ASL01 | Amount missing or below GHS 1.00. | Provide an amount of at least GHS 1.00. |
| ASL02 | Receiver missing. | Provide the recipient phone number. |
| ASL03 | Incomplete request. | Check all required request fields. |
| ASL04 | Channel not supported. | Use MTN, TELECEL, or AT, or the corresponding legacy value 1, 6, or 7. |
| ASL05 | Type invalid. | Send type 1. |
| ASL06 | Unknown error; the sale may still have gone through. | Confirm the sale status before any retry. Do not generate a new reference to resubmit an uncertain sale. |
| ASL08 | External reference missing or already used. | Use a unique reference per wallet for a new sale. Check the original sale before attempting a duplicate. |
| ASL09 | Currency is not GHS. | Send currency GHS. |
| ASL10 | Wallet currency not supported. | Use a wallet with a supported currency for this GHS sale. |
| ASL12 | Wallet inactive. | Check the wallet activation state. |
| ASL13 | Account number not found. | Check the paying wallet account number. |