PaystackGateway class
Client-side Paystack gateway implementation that launches a WebView checkout flow and resolves with a PaymentResult.
Use this class when you want to charge a user in-app with their card or other Paystack-supported methods.
Example:
final gateway = PaystackGateway(publicKey: 'pk_test_123');
final result = await gateway.pay(
context: context,
amountSmallestUnit: 150000, // ₦1,500.00
email: 'customer@example.com',
);
if (result is PaymentSuccess) {
debugPrint('Payment OK: ${result.data}');
} else if (result is PaymentFailure) {
debugPrint('Payment failed: ${result.message}');
}
- Implemented types
Constructors
- PaystackGateway.new({required String publicKey})
- Creates a new PaystackGateway with the given Paystack public key.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The human-readable name of this gateway (e.g.,
"Paystack"
,"Mollie"
).no setteroverride - publicKey → String
-
Paystack public key (
pk_...
) used to initialize checkout.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pay(
{required BuildContext context, required int amountSmallestUnit, required String email, String currency = 'NGN', String? reference}) → Future< PaymentResult> -
Opens a Paystack WebView checkout and resolves to a PaymentResult.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited