PaystackConfig class

App-level default configuration for pay_with_paystack.

Set once at app startup using PayWithPayStack.configure to avoid repeating your secret key, currency and callback URL on every call.

Example

// In main() or your DI setup:
PayWithPayStack.configure(PaystackConfig(
  secretKey: 'sk_live_xxxxxxxxxxxxxxxxxxxx',
  currency: 'GHS',
  callbackUrl: 'https://my-app.com/payment/callback',
  enableLogging: false,
));

// Later — secretKey / currency / callbackUrl can be omitted:
await PayWithPayStack().now(
  context: context,
  customerEmail: 'user@example.com',
  reference: PayWithPayStack().generateUuidV4(),
  amount: 50.00,
  transactionCompleted: (data) => print('Paid!'),
  transactionNotCompleted: (reason) => print('Failed: $reason'),
);

Constructors

PaystackConfig({required String secretKey, String? currency, String? callbackUrl, bool enableLogging = false, Duration timeout = const Duration(seconds: 30)})
const

Properties

callbackUrl String?
Callback URL that Paystack redirects to after checkout.
final
currency String?
ISO 4217 currency code (e.g. 'GHS', 'NGN').
final
enableLogging bool
When true, request/response details are printed to the console via debugPrint (no-op in release mode).
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secretKey String
Your Paystack secret key (sk_live_… or sk_test_…).
final
timeout Duration
Maximum time to wait for the Paystack API to respond before timing out.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited