pay_with_paystack 1.4.0
pay_with_paystack: ^1.4.0 copied to clipboard
A Flutter plugin for Paystack payments via WebView. Supports card, mobile money, bank transfer, USSD, QR, EFT, split payments, custom fields, and a customisable checkout UI.
1.4.0 #
New Features #
- Added
progressColorandprogressBackgroundColorparameters tonow()and internal checkout widgets to allow customisation of the loading spinner, linear progress bar, verification overlay spinner, and action buttons.
Bug Fixes #
- Fixed an infinite page loading/refreshing loop in the checkout WebView by caching the
WebViewControllerin the state instead of recreating it on every widget rebuild.
1.3.0 #
New Features #
- Added
timeoutparameter (Duration, default 30 s) tonow()to prevent indefinite hanging on slow networks. - Added
onTimeoutcallback, fired specifically when the API call times out. Falls back totransactionNotCompleted('timeout')if not set. - Added
enableLoggingflag. Settrue(or usePaystackConfig(enableLogging: kDebugMode)) to print request/response details viadebugPrint. Silent in release builds. - Added WebView progress bar — a
LinearProgressIndicatornow appears at the top of the AppBar while the checkout page loads. - Added
PaymentData.requestedAmountInMajorUnitconvenience getter, mirroringamountInMajorUnitfor therequestedAmountfield. - Added
PaystackConfig— app-level config class. CallPayWithPayStack.configure(config)once inmain()to setsecretKey,currency,callbackUrl,enableLogging, andtimeoutas global defaults. Individualnow()calls can still override any field. - Added
PayWithPayStack.configure(),clearConfig(), andcurrentConfig— static API for managing global config. - Added
transactionCancelledcallback — aVoidCallback?fired when the user explicitly closes the WebView without completing a payment (close button or cancel URL). Previously both cancel and failure routed totransactionNotCompleted. secretKey,currency, andcallbackUrlare now optional onnow()when a globalPaystackConfighas been set viaconfigure().- Added
PaystackCartItem.imageUrl— optional product image URL included in cart metadata, visible on the Paystack Dashboard when viewing a transaction. - Added
PaystackCurrencyenum — typed, IDE-friendly enum for all supported Paystack currencies:ngn,ghs,zar,usd,kes,xof,egp,rwf. UsePaystackCurrency.ghs.valueinstead of the raw string'GHS'. - Added
chargeAuthorization()— silently charges a returning customer using a saved authorization code without showing a WebView. CallsPOST /transaction/charge_authorizationdirectly. - Added
PaystackBulkChargeItem— typed model for building bulk charge batches. UsetoJson()to serialise items forPOST /bulkcharge.
Improvements #
_checkTransactionStatusnow handlesTimeoutExceptionexplicitly with a user-friendly message instead of a silent network error.- The AppBar close button now correctly fires
transactionCancelledinstead of_checkTransactionStatuson a user-initiated close.
Exports #
PaystackConfig,PaystackCurrency, andPaystackBulkChargeItemare now exported frompay_with_paystack.dart.
1.2.0 #
New Features #
- Added customer prefill —
customerFirstName,customerLastName, andcustomerPhonepre-fill the Paystack checkout form and appear on the Dashboard automatically. - Added
cartItems: List<PaystackCartItem>— attaches typed line items to transaction metadata (name, amount, quantity). Amounts are in the major currency unit. - Added
customFields: List<PaystackCustomField>— typed, structured fields visible on the Paystack Dashboard for every transaction. - Added split payment parameters —
subaccount,splitCode,transactionCharge, andbearerfor routing payments to subaccounts or pre-defined split groups. - Added
invoiceLimit— controls how many times a customer is charged on a subscription plan. - Added
PaystackBearerenum — type-safeaccount/subaccountfee-bearer selection. - Added
PaystackCartItemmodel — typed cart line item withname,amount,quantity. - Added
PaystackCustomFieldmodel — typed custom field withdisplayName,variableName,value. - All new model types are exported from
pay_with_paystack.dart.
1.1.0 #
New Features #
- Added
PaystackChannelenum for type-safe payment channel selection. - Added
planparameter to expose subscription plan codes through the public API. metadatais now typed asMap<String, dynamic>?instead ofdynamic.- Added AppBar customisation —
showAppBar,appBarTitle,appBarColor,appBarTextColor. - Added
loadingWidgetparameter for a custom loading widget. - Added
errorWidgetbuilder parameter for a custom error widget with retry callback. - Retry button on the default error screen retries payment initialisation.
- Added a non-dismissible verification overlay shown while verifying the transaction.
- Added branded loading and error UIs with a pulsing logo animation.
- Added
expMonth,expYear,reusable, andsignaturefields toAuthorization. - Added
metadatafield and computedfullNamegetter toCustomer. - Added
requestedAmountandorderIdfields toPaymentData. - Added
isSuccessful,amountInMajorUnit, andfeesInMajorUnithelpers toPaymentData. - Added
toString(),copyWith(),==, andhashCodeto all models. - Added
PaystackException— typed exception withmessage,statusCode,responseBody. - Importing
pay_with_paystack.dartnow re-exports all model types.
Bug Fixes #
- Fixed crash:
response!force-unwrap after a caught exception now throws a typedPaystackExceptioninstead of crashing withNull check operator used on a null value. NavigationDecision.preventis now returned when the cancel or callback URL is detected.
Tests #
- Added comprehensive unit test suite for all models and utilities.
1.0.14 #
- Initial tracked release.