Flutter plugin bridging Monext's native Android/iOS payment SDKs to a unified Dart API.
A Dart call to MonextPayment.startPayment(...) hosts Monext's native payment UI full-screen on
top of the Flutter app (a dedicated Activity on Android, a modally-presented view on iOS),
initializes the native SDK with the given session token/environment/appearance, and relays the
payment outcome back to Dart once the flow completes. See docs/ for the architecture and design
decisions behind this, and
Project Setup Requirements for what a consuming app
needs to configure beyond adding this dependency.
import 'package:monext_flutter_sdk/monext.dart';
await MonextPayment.initialize();
await MonextPayment.startPayment(
sessionToken: sessionToken,
environment: MonextEnvironment.production,
appearance: const MonextAppearance(headerTitle: 'Pay now'),
onPaymentResult: (result) {
// Raw MonextPaymentResult wire value (e.g. "captured", "failed",
// "cancelled"); decode with MonextPaymentResult.fromValue.
},
);MonextPayment.initialize()sets up the plugin and is idempotent: calling it again is a no-op.MonextPayment.startPayment(...)transmitssessionToken,environmentand the optionalappearance,language,googlePayConfigurationandapplePayConfigurationto native code as a structured message. All of these are optional and any field left unset (including a whole parameter) falls back to the native SDK's own default.googlePayConfigurationis ignored on iOS andapplePayConfigurationis ignored on Android — each platform only has the matching wallet button, and passing one costs nothing on the platform that ignores it. Enabling either wallet button for real also requires native project setup this plugin can't do on its own — see Google Pay Setup and Apple Pay Setup.onPaymentResultis invoked once, later, with the raw value native code sends when the payment flow completes; it applies no validation or transformation of its own, and is not invoked ifstartPaymentitself throws. CallingstartPaymentagain while a previous call is still in progress cancels that previous request: only the latest call's outcome is ever relayed toonPaymentResult.- It throws
MonextPaymentNotInitializedExceptionif called beforeinitialize(), anArgumentErrorifsessionTokenis empty, aMonextPaymentChannelUnavailableExceptionif no native handler is registered for theMethodChannel, and aMonextPaymentNativeExceptionif the native SDK rejects the request synchronously (e.g. an invalid or expired session token), carrying its rawerrorCodeandmessage.
The example app is a runnable test screen with a session token field, an environment
picker and a Buy button wired to startPayment. See example/README.md
for how to run it and get a test session token.