Micropay class
The main Micropay client for Flutter applications.
Use this class to create and manage payment intents.
Example:
final micropay = Micropay(publicKey: 'pk_test_...');
final intent = await micropay.createPaymentIntent(
amount: 500,
phoneNumber: '254712345678',
);
Constructors
Properties
- config → MicropayConfig
-
The current configuration.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isTestMode → bool
-
Whether the client is in test mode.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelPaymentIntent(
String paymentIntentId) → Future< PaymentIntent> - Cancels a payment intent.
-
confirmPaymentIntent(
String paymentIntentId, String clientSecret) → Future< PaymentIntent> - Confirms a payment intent.
-
createPaymentIntent(
{required int amount, required String phoneNumber, String currency = 'KES', String? description, Map< String, dynamic> ? metadata, String? idempotencyKey}) → Future<PaymentIntent> - Creates a new payment intent.
-
dispose(
) → void - Disposes the HTTP client.
-
getPaymentIntent(
String paymentIntentId) → Future< PaymentIntent> - Retrieves a payment intent by ID.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pollPaymentStatus(
String paymentIntentId, {Duration pollInterval = const Duration(seconds: 2), int maxAttempts = 60, void onStatusChange(PaymentIntentStatus status)?}) → Future< PaymentIntent> - Polls for payment completion.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited