pay_with_paystack 1.6.1
pay_with_paystack: ^1.6.1 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.6.1 #
Documentation #
- Updated the
README.mdto document all new Web styling and text customization parameters with their exact defaults. - Replaced the HEIC format screenshots with PNG equivalents in the repository and updated the README screenshots section.
1.6.0 #
New Platform: Flutter Web #
- Flutter Web support:
PayWithPayStack().now()works on web with the same signature. - On web, the Paystack checkout page opens in a new browser tab (embedded WebViews are not available on Flutter Web).
- A branded full-screen waiting page is shown while the user completes payment in the new tab. It displays the payment summary (amount, email, reference) and guides the user through the process.
- Once the user returns and taps "I've completed payment", the transaction is verified server-side and the appropriate callback fires automatically.
- A "Reopen checkout tab" button is available in case the user accidentally closes the Paystack tab before finishing.
- The web checkout UI is responsive: on wide screens (≥ 640 px) the content is centred in a card layout; on narrow screens it renders edge-to-edge.
- Scrollable Web Layout: Wrapped the web card inside a
SingleChildScrollViewon wide screens to prevent overflow on shorter browser windows/screens. - Added
url_launcheras a dependency to support opening URLs on web.
UI Customization on Web #
- Full Customizability: Added properties to customize the web payment waiting page entirely.
- Colors/Backgrounds:
backgroundColor,cardBackgroundColor,cardBorderColor,primaryTextColor,secondaryTextColor,buttonTextColor. - Texts:
connectingText,waitingTitleText,waitingSubtitleText,step1Text,step2Text,step3Text,completedButtonText,reopenButtonText,cancelButtonText,verifyingText,verifyingSubtitleText.
- Colors/Backgrounds:
- Flexible Logo Widget: Replaced
logoUrlparameter withlogoWidget(e.g.logoWidget: Image.network(...)or local assetlogoWidget: Image.asset(...)to seamlessly bypass CORS limits and rendering issues on Flutter Web).
1.5.0 #
New Features #
-
Added
progressColorandprogressBackgroundColorto customize the accent and track colors of the linear progress bar, loading widget, verification spinner, and "Try Again" button. -
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.