MobileMoneyRequest class
Payment request for mobile money payments.
This class represents a mobile money payment request for wallets like M-Pesa, Airtel Money, Vodafone Cash, and Tigo Cash. The customer will receive a prompt on their mobile device.
Properties
- provider: Mobile money provider (MobileMoneyProvider)
- phoneNumber: Customer's phone number with country code
Supported Providers
- MobileMoneyProvider.airtel: Airtel Money (multiple countries)
- MobileMoneyProvider.vodafone: Vodafone Cash (Ghana, requires GHS)
- MobileMoneyProvider.tigo: Tigo Cash (Ghana, requires GHS)
Example
final request = MobileMoneyRequest(
amount: 25000, // ₦250.00
currency: Currency.ngn,
email: 'customer@example.com',
provider: MobileMoneyProvider.mpesa,
phoneNumber: '+254712345678',
reference: 'mobile_money_123',
);
final response = await AllPaystackPayments.initializePayment(request);
- Inheritance
-
- Object
- PaymentRequest
- MobileMoneyRequest
Constructors
-
MobileMoneyRequest.new({required int amount, required Currency currency, required String email, String? reference, Map<
String, dynamic> ? metadata, String? callbackUrl, required MobileMoneyProvider provider, required String phoneNumber})
Properties
- amount → int
-
Amount to be charged in kobo (smallest currency unit)
finalinherited
- callbackUrl → String?
-
Callback URL for web payments
finalinherited
- currency → Currency
-
Currency for the transaction
finalinherited
- email → String
-
Email address of the customer
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
metadata
→ Map<
String, dynamic> ? -
Additional metadata for the transaction
finalinherited
- paymentMethod → PaymentMethod
-
Payment method type
finalinherited
- phoneNumber → String
-
Phone number associated with the mobile money account
final
- provider → MobileMoneyProvider
-
Mobile money provider
final
- reference → String?
-
Unique reference for the transaction (optional, will be generated if not provided)
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getSpecificJson(
) → Map< String, dynamic> -
Method to be implemented by subclasses for payment-method-specific data.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Convert request to JSON for API call.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → void -
Validate the request data.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited