Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR threads an idempotencyKey through the app’s payment redirect flows (Flutter → platform channels/FFI → Go core) so the backend can make redirect-checkout/session creation idempotent, addressing the linked engineering issues.
Changes:
- Added
idempotencyKeyas a required parameter to the Dart payment redirect APIs and passed it through both FFI and platform-channel implementations. - Generated an idempotency key in
PaymentNotifierand included it in redirect calls. - Updated Go mobile/FFI exports and core payment methods to accept and forward the idempotency key in the redirect request body.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| macos/Runner/Handlers/MethodHandler.swift | Reads idempotencyKey from method-channel args and passes it into Go mobile payment redirect calls. |
| android/app/src/main/kotlin/org/getlantern/lantern/handler/MethodHandler.kt | Passes idempotencyKey from method-channel args into Mobile.paymentRedirect. |
| lib/lantern/lantern_core_service.dart | Extends core service interface with required idempotencyKey for redirect methods. |
| lib/lantern/lantern_service.dart | Propagates idempotencyKey through the top-level service wrapper. |
| lib/lantern/lantern_platform_service.dart | Sends idempotencyKey via method channel for macOS/Android redirect flows. |
| lib/lantern/lantern_ffi_service.dart | Sends idempotencyKey into FFI calls for redirect flows. |
| lib/lantern/lantern_generated_bindings.dart | Updates generated FFI bindings signatures to include idempotencyKey. |
| lib/features/plans/provider/payment_notifier.dart | Generates and supplies an idempotency key when starting redirect flows. |
| lib/core/common/common.dart | Adds generatePaymentRedirectIdempotencyKey() helper. |
| lantern-core/core.go | Adds idempotencyKey to redirect APIs and forwards into account.PaymentRedirectData. |
| lantern-core/ffi/ffi.go | Updates exported C functions to accept and forward idempotencyKey. |
| lantern-core/mobile/mobile.go | Updates gomobile exports to accept and forward idempotencyKey. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jigar-f
reviewed
May 7, 2026
|
|
||
| func (lc *LanternCore) StripeSubscriptionPaymentRedirect(subscriptionType, planID, email string) (string, error) { | ||
| func (lc *LanternCore) StripeSubscriptionPaymentRedirect(subscriptionType, planID, email, idempotencyKey string) (string, error) { | ||
| idempotencyKey, err := normalizePaymentRedirectIdempotencyKey(idempotencyKey) |
Contributor
There was a problem hiding this comment.
@atavism Do you think we should just create the idempotencyKey key here, since generation is basically the same, so we don't have to pass it through all the platforms? Is there any issue with that?
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.
For https://github.com/getlantern/engineering/issues/3434 and https://github.com/getlantern/engineering/issues/3292