Overview
PurchaseInfo encapsulates all the necessary information about a purchase transaction, including the amount, customer details, and transaction references.
Constructor
Parameters
The total amount to be charged for this purchase. Should be a positive number.
The customer’s phone number in Ghanaian format (e.g., ‘0241234567’ or ‘233241234567’). This is used for mobile money payments and customer identification.
A description of what the customer is purchasing. This appears in transaction records and receipts.
Your unique reference ID for this transaction. Use this to track and reconcile payments in your system.
Properties
The purchase amount to be charged.
The customer’s phone number as provided.
Description of the purchase.
Your unique transaction reference ID.
A getter that returns the formatted customer phone number in MSISDN format. This is automatically generated from
customerPhoneNumber.Usage Example
Phone Number Format
ThecustomerPhoneNumber accepts various Ghanaian phone number formats:
0241234567- Local format233241234567- International format without plus+233241234567- International format with plus
customerMsisdn getter.
Client Reference Best Practices
- Make references unique across all transactions
- Include identifiable information (order ID, customer ID, timestamp)
- Keep references alphanumeric for compatibility
- Store the reference in your database for transaction tracking
- Examples:
ORDER-123456,INV-2024-001,SUB-USER-789-20240315