fbpx

Discover our new campaign management platform. Learn more

section-9134a21

API-AIRTIME

section-1
1 Scope

LAMAIRTIME is a proxy / API for sending airtime (phone credit) to numbers subscribed to your service, using an API interface.
LAMAIRTIME offers two interfaces :
- via Web: the user connects via a browser
- via API: the client's application exchanges information automatically with the LAfricaMobile platform
This document describes the second way and explains how to use this API.

section-2
2 Account settings
2.1 Prerequisites

To use this API, you need a valid account. When creating your account, LAfricaMobile must give you:
- a login (also called accountid) ( also named accountid)
- a password
- an amount
- a phone
- an operator
- callback
This username / password pair is used as an identification parameter in the API.

2.2 Variables used in the documentation

In this document, we use values below. The real values will be given to you by our technical team or by your own configuration (for parameters depending on your side, callback for example). Some of them may not be used depending on your needs.
Document test values :
- login=fred
- password=xpasswordx
- montant=100
- telephone = 221773758085
- operateur = ORANGESN
- callback = https://votreentreprise.com/reception
- AIRTIME Server url : https://mtpremium-prod.lafricamobile.com

You should replace these values with your own settings during your tests.

section-3
3 Send credit
3.1 How send via http

Instead of having all parameters encapsulated, you can directly GET parameters individually :

Parameters are :

Name Mandatory Sample value Comment
login Y fred Value given by LAM
password Y xpasswordx Value given by LAM
montant Y 100 Amount to send
operateur Y ORANGESN Operator code
telephone Y 221773758085 User phone number
callback N https://votreentreprise.com/reception the acknowledgment url

So you can make a call directly in your browser. Here is an example of request :
https://airtime.lafricamobile.com/airtime?login=fred&password=
xpasswordx&operateur=ORANGESN&montant=100&telephone=221773758085&callback=https://votreentreprise.com/reception

3.2 How to send via PHP code

Here is an example with the PHP script :

RESPONSE OK

Content-Type: application/json

{"service_id":"AIRTIMEORANGE","gu_transaction_id":"1585825004905","s
tatus":"PENDING","transaction_date":"2020/04/02 10:56:44
AM","recipient_phone_number":"773758085","amount":100,"partner_transact
ion_id":"5e85c4eca79c6"}

section-4
4 Real-time acknowledgment

In this case, our server calls an url when it detects that its status needs to change.
This url must be provided in the parameter named callback

This callback is called with these parameters in an HTTP JSON request.

{"service_id":"AIRTIMEORANGE","gu_transaction_id":"1585825004905",
"status":"SUCCESSFUL|FAILED","partner_transaction_id":"5e85c4eca79c6",
callback="https://votreentreprise.com/reception"}