How it works
Below is an illustration of the flow of an airtime request:
A client's app sends Africa's Talking (AT) API an airtime request (arrow 1a)
AT immediately responds to the client regarding the airtime request (arrow 1b). The response will indicate whether the request has been accepted successfully or rejected due to several such as a wrong amount provided in the request. This is a mandatory response to the client, no callback is required. Sample response:
{
"errorMessage": "None",
"numSent": 1,
"totalAmount": "KES 1000.0000",
"totalDiscount": "KES 40.0000",
"responses": [{
"phoneNumber": "+254711XXXYYY",
"errorMessage": "None",
"amount": "KES 1000.0000",
"status": "Sent",
"requestId": "ATQid_1be914ac47845eef1a1dab5d89ec50ff",
"discount": "KES 40.0000"
}]
}
Assuming the airtime requested was accepted successfully by the API, it will be sent to the telco for processing (arrow 2). At this point, the transaction will be visible on your AT dashboard with the status Sent (implying that it has been sent to the telco for processing)
The telco processes the transaction and once completed notifies AT regarding the fate of the airtime transaction (arrow 3) in terms of final status (Success/Failed).
AT relays the final status of the airtime request to the client (arrow 4) by posting it to the dashboard or the callback (this is an optional response to the client, you will be required to register a callback). Sample callback response :
{
"phoneNumber":"+254711XXXYYY",
"description":"Airtime Delivered Successfully",
"status":"Success",
"requestId":"ATQid_SampleTxnId123",
"discount":"KES 0.6000",
"value":"KES 100.0000"
}
โPS: Arrow 1b should NOT be treated as the final response of the airtime request. The final status for the airtime request is always provided through arrow 4.
Learn more about airtime requests here
Have more questions? Contact us at airtime@africastalking.com