uni_payments 0.0.10
uni_payments: ^0.0.10 copied to clipboard
Unified Flutter API over Razorpay, Stripe, PayPal, Paystack, Flutterwave, Paytm, Cashfree, PhonePe, PayU, Square, Airwallex, Google Pay and Apple Pay.
0.0.10 #
- Upgrade
square_in_app_paymentsto ^2.0.0 (iOS now integrates via Swift Package Manager; CocoaPods still works). No API changes for callers. - Breaking for older toolchains: raise the minimum SDK to Flutter
3.44.0/ Dart3.12.0, as required bysquare_in_app_payments2.x. - Clean up
payu_gateway.dart(formatting + private initializing formals) so static analysis is lint-free on Dart 3.12.
0.0.9 #
New gateways #
- PayU (
UniPayments.payWithPayu) — India, Latin America, Turkey and Central/Eastern Europe. Usespayu_checkoutpro_flutter^1.4.5. PayU signs every checkout step with an HMAC hash computed from your merchant salt, sopayWithPayutakes agenerateHashcallback that you wire to your own backend — the salt must never ship client-side. - Square (
UniPayments.payWithSquare) — US, UK, Canada, Australia. Usessquare_in_app_payments^1.7.14 (pinned below 2.x on purpose — see the pubspec comment — to avoid raising this package's Flutter floor to 3.44 for an optional gateway). Like Braintree/Google Pay/Apple Pay, this only tokenizes a card into a nonce; charge it server-side via Square's Payments API. Requires AndroidminSdkVersion 28if used. - Airwallex (
UniPayments.payWithAirwallex) — global, particularly strong in Hong Kong, Singapore and Australia. Uses the officialairwallex_payment_flutter^0.4.0 and presents Airwallex's full hosted payment sheet. Apayment_in_progressresult means the payment was submitted but not yet confirmed — verify via your backend, the same as Razorpay's external-wallet case. - Demo app updated with tiles for all three.
Considered and rejected #
upi_pay(direct UPI-intent payments) — looked promising on points/likes/downloads, but it's officially marked discontinued on pub.dev. Not included.- Midtrans (Indonesia) — the only maintained wrapper,
midtrans_sdk1.2.0, has a confirmed bug: its iOS native bridge sendstransactionStatus/statusMessage/orderIdkeys, but the Dart-side parser only readsstatus/message— every transaction outcome fails to parse there and the result callback silently never fires. Android has a separate gap: cancelling via the system back button never triggers the finished-callback at all. Not included; revisit if the package is fixed upstream.
0.0.8 #
- Upgrade
flutter_stripe^13.1.0->^14.0.0, clearing pub.dev's outdated dependency score. 14.0.0's only breaking change is Android Gradle Plugin 9 support; the PaymentSheet APIs this package uses (initPaymentSheet,presentPaymentSheet,StripeException,FailureCode,PaymentSheetApplePay,PaymentSheetGooglePay) are unchanged, so no code changes were required. - Fixed a Cashfree race condition:
CFPaymentGatewayServiceis a process-wide singleton with static callback fields upstream. CallingpayWithCashfreeagain before a prior call finished silently overwrote the first call's callbacks, leaving it hanging forever and risking a stray callback resolving the wrong call.payWithCashfreenow rejects a concurrent call immediately with aPaymentFailure(cashfree_already_in_progress) instead. - Fixed a Paystack rounding bug:
amount * 100had no rounding, so a value like19.99could become1998.9999999999998in floating point, risking an off-by-a-cent charge. Now rounded the same way Razorpay already does. - Added an optional
timeoutparameter topayWithRazorpayandpayWithCashfreeso callers can bound how long they wait for the native SDK's callback instead of hanging indefinitely if it never fires. Defaults to no timeout, matching prior behaviour. - Every gateway's exception path now also populates
PaymentResult .rawResponsewith the raw exception detail (and, for Stripe, decline code / Stripe error code) for backend/audit logging, in addition to the existing human-readablemessage.
0.0.7 #
- Raise the minimum Flutter SDK to
3.41.0soflutter_stripecan be upgraded to13.1.0, which clears pub.dev's outdated dependency score. - Upgrade direct dependencies:
braintree_flutter_plus^5.2.1->^7.0.1flutter_cashfree_pg_sdk^2.3.4->^2.4.0+52flutter_stripe^12.6.0->^13.1.0
- Update the PayPal/Braintree flow to the newer
BraintreeDropIn.start(context, request)API, which meansUniPayments.payWithPaypal(...)now requires aBuildContext. - Raise the example app's iOS deployment target to
16.0forbraintree_flutter_plus7.x compatibility. - Refresh README examples and release metadata for the new package version.
0.0.6 #
New gateways #
- Cashfree (
UniPayments.payWithCashfree) — India. Uses Cashfree's Web Checkout SDK (flutter_cashfree_pg_sdk^2.3.4). Server-driven — pass anorderId+paymentSessionIdfrom your backend. - PhonePe (
UniPayments.payWithPhonepe) — India / UPI. Uses the officialphonepe_payment_sdk^3.0.2. Server-driven — pass a base64-encoded request body assembled by your backend.
Braintree → braintree_flutter_plus #
- Switched the PayPal/Braintree integration from the abandoned
flutter_braintreeto the maintained forkbraintree_flutter_plus^5.2.1. API is identical; no consumer changes required.
API naming polish #
All methods, params and result fields were renamed for self-documenting, IDE-discoverable consumption:
- Methods all prefix
payWith*soUniPayments.paylists every gateway in autocomplete:payWithRazorpay,payWithStripe,payWithPaystack,payWithFlutterwave,payWithPaytm,payWithPaypal,payWithGooglePay,payWithApplePay. canUseWallet→isWalletSupported.- Params disambiguated:
key→keyId,name(ambiguous) →businessName,staging→useStagingEnvironment,country→countryCode,appleMerchantId→applePayMerchantId,paymentConfiguration→paymentConfigurationJson,label→lineItemLabel,itemStatus→lineItemStatus,itemType→lineItemType. PaymentResultfields are now unambiguous on the consumer side:code→errorCode,raw→rawResponse,gateway→gatewayName.
Developer experience #
UniCustomervalue class —name,email,phoneget passed once and reused across every gateway that prefills a checkout form, instead of being re-declared per-call.Color(not hex string) forthemeColor— Razorpay accepts any FlutterColor; the gateway converts to Razorpay's#RRGGBBformat internally.- Imperative wallets:
UniPayments.googlePay(...)andUniPayments.applePay(...)returnFuture<PaymentResult>just like every other gateway, so you canawaitthem from a custom button. The nativegooglePayButton/applePayButtonwidgets are still there for when Google / Apple's UX guidelines require them. UniPayments.canUseWallet(WalletProvider.applePay, config)— probe whether the device actually supports a wallet before showing the button.- Gateway-aware results: every
PaymentResultis stamped with the originatinggatewaystring (razorpay,stripe,apple_pay, ...) so consumers can branch by gateway without tracking it themselves. - Consistent naming sweep:
keyId(notkey),businessName(not ambiguousname),customer(not separateemail/name/phone),staging(notisStaging),testMode(notisDebugMode).
Highlights #
- Every gateway is now actually functional and validated against the
upstream APIs of
razorpay_flutter1.4,flutter_paystack_max1.0,flutterwave_standard1.1,paytm_allinonesdk1.2,flutter_braintree4.0,flutter_stripe12.6 andpay3.3. - Stripe PaymentSheet now wires up Apple Pay + Google Pay correctly via
applePayMerchantIdandmerchantCountryCode. - Razorpay external-wallet event is reported as a distinct
external_wallet_pendingfailure code so you know to verify via webhook instead of treating it as paid. - Paytm response is normalised across both Android and iOS flows
(top-level vs. nested-under-
response), andRESPCODE 141is mapped toPaymentCancelled. - Every facade method input-validates non-empty keys + positive amount before hitting the native SDK.
- Wallet buttons no longer force
width/height— they size themselves per Google/Apple guidelines (usemarginand aSizedBoxif needed).
Breaking #
- Public API redesign. Every gateway now returns
Future<PaymentResult>— a sealed type with three cases (PaymentSuccess,PaymentFailure,PaymentCancelled). The oldUniPaymentResponse+ callback pattern has been removed. - Renamed methods to drop the redundant
Paymentsuffix:razorPayPayment→razorpay,payStackPayment→paystack,paytmPayment→paytm,flutterWavePayment→flutterwave,payPalBraintreePayment→braintree,uniPaymentGooglePayButton→googlePayButton. - Renamed parameters:
receiptantName→name,uniqueRefrenceID→reference,emailId→email,colorCode→themeColor,isDebugMode→testMode,uniqueTransactionToken→txnToken,isStaging→staging. - Removed the unused
MethodChannel/PlatformInterfacescaffolding — this is a pure-Dart package now; the emptyandroid/andios/directories were deleted. - Removed
flutter_web_pluginsandplugin_platform_interfacedeps.
Added #
- Stripe support via
flutter_stripe 12.6and the PaymentSheet API. - Apple Pay widget builder via
pay 3.3. - Strongly-typed
UniPaystackCurrencyenum (no upstream import needed). - Cancellation is now a first-class outcome — switch over
PaymentResultto handle it explicitly. - Full
==/hashCode/toStringon everyPaymentResultvariant.
Fixed #
- PayPal/Braintree: inverted success/failure branches, null-deref crash on user cancellation.
- Paystack:
print(secretKey)was leaking the secret to logs. - Paytm: status field was being passed straight through as a
booleven though it's aStringlikeTXN_SUCCESS. - Razorpay: instance was never
clear()ed, leaking listeners on each call. - Razorpay: amount is now correctly rounded to integer paise.
- All gateways:
BuildContextis checked formountedafter async gaps.
Changed #
- Bumped SDK floor to Flutter 3.32 / Dart 3.8.
- Upgraded every dependency to its latest stable:
razorpay_flutter1.3.7 → 1.4.5flutter_paystack_max1.0.4 → 1.0.6flutterwave_standard1.0.8 → 1.1.0 (constructor +charge()API)paytm_allinonesdk1.2.5 → 1.2.8pay2.0.0 → 3.3.0flutter_braintree^4.0.0flutter_stripe^12.6.0 (new)
- Strict analyzer settings (
strict-casts,strict-inference,strict-raw-types) andflutter_lints5.
Example app #
- Complete rewrite — Material 3, dark + light themes, animated gradient background, glass-morphism cards, responsive grid, live result card.
0.0.5 #
- Web platform removed due to unsupported SDKs.
0.0.4 #
- Solve Pub Analytics Issues.
0.0.3 #
- Major Version Update - PayPal Added.
0.0.2 #
- Google Pay Integration.
0.0.1 #
- Initial Release.