docs: Add a session-token/buy test screen to the example app - #33
Merged
Conversation
Replace the boilerplate platform-version screen with a minimal form (session token, environment picker, Buy button) that exercises MonextPayment.startPayment and shows the resulting MonextPaymentResult, so the example app doubles as a manual test harness. Document how to use it in example/README.md and link it from the root README.
Flutter is dropping support for plugins that apply KGP themselves, now that AGP 9+ ships built-in Kotlin support (see Flutter's migrate-to-built-in-kotlin guide for plugin authors). Only fall back to applying org.jetbrains.kotlin.android for AGP < 9, which has no built-in Kotlin support of its own.
Add an MIT LICENSE (the plugin wraps Monext's native SDKs via method channel rather than embedding their source, so MIT applies regardless of how those SDKs are themselves licensed) and fill in the pubspec.yaml fields pub.dev scores/displays: repository, issue_tracker and topics. No CHANGELOG.md: changelogs for this repo are generated from GitHub releases via convco, not maintained by hand.
detachFromActivity() only dropped the local paymentLauncher reference without unregistering it from the Activity's ActivityResultRegistry, which owns the registration by a fixed key. A later onAttachedToActivity() call on the same Activity (e.g. after a hot restart) then re-registered that same key, which throws and leaves the new plugin instance's paymentLauncher null - so every startPayment() call failed with "activity_unavailable" from then on.
FlutterActivity (the Activity subclass used by the vast majority of Flutter apps, including this plugin's own example app) extends plain android.app.Activity, not AndroidX's ComponentActivity. The plugin's onAttachedToActivity() cast the bound Activity to ComponentActivity and silently returned on failure, so paymentLauncher was never set and every startPayment() call failed with "activity_unavailable" - deterministically, not just on hot restart. Replace the ActivityResultRegistry-based launcher with the PluginRegistry.ActivityResultListener + Activity.startActivityForResult APIs, which work against any Activity subclass and are the mechanism Flutter itself documents for this use case. Drop the now-unused PaymentActivity.LaunchArgs/ActivityResultContract plumbing, and update the unit tests accordingly (the onActivityResult tests drive the listener directly with a mocked Intent, since constructing a real one throws in this project's Robolectric-less unit tests).
Both PaymentBox (Android) and presentPaymentSheet (iOS) render as a bottom sheet, not a full page, but their host Activity/ViewController was styled/presented as opaque fullscreen - showing as an empty black backdrop behind the sheet instead of the app underneath. - Android: give PaymentActivity a transparent theme (windowIsTranslucent + transparent windowBackground) instead of Theme.NoTitleBar.Fullscreen. - iOS: present the hosting controller with .overFullScreen instead of .fullScreen, and clear its view's background, so the presenting app stays visible/live behind the transparent SwiftUI content.
Consuming apps failed full-mode R8 minification with "Missing classes detected" for com.android.extensions.xr.*/ com.google.androidxr.splitengine.* - Compose UI's optional Android XR (SceneCore) support references OEM-only classes that aren't on the classpath for a normal (non-XR) device. Ship a consumer-rules.pro with -dontwarn for those packages so apps depending on this plugin don't each have to work this out themselves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MonextPayment.startPayment, displaying the resultingMonextPaymentResultor error.example/README.md(prerequisites, running the app, getting a test session token, walkthrough of the Buy flow).README.mdunder a new "Try it" section.Test plan
flutter pub get && flutter runinexample/and confirm the app builds and shows the session token/environment/Buy UI.flutter analyzeinexample/with no new warnings.Generated by Claude Code