The purchase phase of a direct top-up purchase follows the validation phase.
Purchase
Before a purchase request can be made, a successful payment for the requested product must be tendered. This is because reversals are not supported for direct top-up purchases and hence any airtime products issued cannot be reversed in the case of a failed tender.
Operations and Messages
| Transaction | Opedration | API Calls |
|---|---|---|
| Purchase | purchase | POST /purchases
|
| Purchase status lookup | purchaseStatus | GET /purchases/status
|
You should not attempt transaction lookups until after the initial processing period concludes (after Electrum has received and processed the transaction outcome).
Message Flows
The sections below describe a successful purchase and possible error scenarios. The table of error types lists the full set of possible error types and the action required should they occur.
If the error indicates a permanent failure, then the consumer should be informed via the relevant channel (i.e., mobile, web, or point of sale), and tender should be reversed.
Successful Airtime Purchase
Refer to 'Purchase Phase' in the diagram below.
- After a purchase trial transaction, the consumer tenders for a purchase transaction (no Electrum involvement).
- The originating system sends a
POSTcall to the/purchasesAPI endpoint. - The API responds with an HTTP status of
201and a PurchaseResponse message payload. - The consumer receives the airtime top-up directly to their cellphone.

Error Upstream: Purchase Failed
- After a purchase trial transaction, the consumer tenders for a purchase transaction (no Electrum involvement).
- The originating system sends a
POSTcall to the/purchasesAPI endpoint. - An error occurs at Electrum or the service provider.
- Electrum returns an ErrorDetail payload indicating that the purchase has failed.
- The consumer is notified of the error and the tender is reversed.

Error Upstream: Unknown Outcome
- After a purchase trial transaction, the consumer tenders for a purchase transaction (no Electrum involvement).
- The originating system sends a
POSTcall to the/purchasesAPI endpoint. - An error occurs when Electrum does not receive a response or receives a response that the transaction is still being processed.
- Electrum returns an error of
UPSTREAM_UNAVAILABLEorOUTCOME_UNKNOWNto the originating system. - The originating system requests the status of the original transaction by sending a
GETcall to the/purchases/statusendpoint. - If Electrum receives a response regarding the transaction status from the service provider, then Electrum will return a PurchaseResponse (approved) or ErrorDetail (declined) response.
- The consumer is informed of the transaction outcome. Tender is reversed in the event of a failed transaction.

Error Upstream: Unknown Outcome and Lookups Fail
- After a purchase trial transaction, the consumer tenders for a purchase transaction (no Electrum involvement).
- The originating system sends a
POSTcall to the/purchasesAPI endpoint. - An error occurs when Electrum does not receive a response or receives a response that the transaction is still being processed.
- Electrum returns an error of
UPSTREAM_UNAVAILABLEorOUTCOME_UNKNOWNto the originating system. - The originating system requests the status of the original transaction by sending a
GETcall to the/purchases/statusendpoint. - Electrum still does not receive a response or receives a response that the transaction is still being processed.
- Electrum returns an error of
UPSTREAM_UNAVAILABLEorOUTCOME_UNKNOWNto the originating system. - The originating system can choose to initiate another purchase status lookup or abort the transaction.

Error or Timeout at Originating System
- After a purchase trial transaction, the consumer tenders for a purchase transaction (no Electrum involvement).
- The originating system sends a
POSTcall to the/purchasesAPI endpoint. - An error occurs at the originating system, or a timeout error occurs when the originating system does not receive a response.
- The originating system requests the status of the original transaction by sending a
GETcall to the/purchases/statusendpoint. - If Electrum receives a response regarding the transaction status from the service provider, then Electrum will return a PurchaseResponse (approved) or ErrorDetail (declined) response. The consumer is informed of the transaction outcome and tender is reversed in the event of a failed transaction.
- If Electrum does not receive a response, or receives a response that the transaction is still being processed, then Electrum will return an error of
UPSTREAM_UNAVAILABLEorOUTCOME_UNKNOWNto the originating system. The originating system can choose to initiate another purchase status lookup or abort the transaction.

There is no explicit restriction on the number of purchase status lookup attempts that may be performed before the transaction should be aborted.