Skip to content

Update deferred Stripe renewal and retry handling - #8952

Merged
jigar-f merged 2 commits into
jigar/stripe-ghost-sub-fixfrom
atavism/stripe-ghost-sub-fix
Aug 6, 2026
Merged

Update deferred Stripe renewal and retry handling#8952
jigar-f merged 2 commits into
jigar/stripe-ghost-sub-fixfrom
atavism/stripe-ghost-sub-fix

Conversation

@atavism

@atavism atavism commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
  • Handle both PaymentIntent and SetupIntent subscription flows
  • Prevent PaymentSheet retries from creating duplicate subscriptions
  • Adds Stripe tests covering both intent modes, retries, initialization, and error filtering

Copilot AI lite review requested due to automatic review settings August 5, 2026 16:40
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a7c2346-37ec-4add-815c-6019c6863e7d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the app’s deferred Stripe PaymentSheet flow to support both PaymentIntent and SetupIntent subscription confirmations (notably for renewal/trial scenarios), while preventing retries from creating duplicate backend subscriptions. It also adds widget tests to validate intent-mode selection, retry behavior, and user-facing Stripe error filtering.

Changes:

  • Add StripeIntentMode + stripeIntentModeForRenewal(...) and use intent-mode–specific confirmation secrets in the deferred confirm handler.
  • Cache the in-flight subscription creation request during PaymentSheet retries to avoid duplicate subscriptions.
  • Add Stripe service widget tests for publishable-key initialization ordering, retry semantics, setup-mode confirmation, and error-message filtering.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lib/core/services/stripe_service.dart Adds intent-mode selection and retry-safe subscription creation for deferred PaymentSheet confirmation; updates Stripe error filtering.
lib/features/auth/choose_payment_method.dart Selects the correct Stripe intent mode for renewals (PaymentIntent vs SetupIntent) and passes it into StripeService.
lib/lantern_app.dart Makes the builder safer when child is null by providing a fallback widget.
test/core/services/stripe_service_test.dart Introduces widget tests validating deferred Stripe flow behavior across intent modes, retries, and error filtering.
Suppressed comments (1)

lib/core/services/stripe_service.dart:196

  • The empty-secret path throws a hard-coded English string that will be shown to users in the PaymentSheet retry UI. This bypasses the app’s i18n approach (used elsewhere in this file via .i18n) and makes the message non-localizable.
      if (secret.isEmpty) {
        throw Exception(
          'Please try again after some time. If the issue persists, contact support.',
        );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/core/services/stripe_service_test.dart
Comment thread test/core/services/stripe_service_test.dart
@atavism
atavism requested a review from jigar-f August 5, 2026 17:19

@jigar-f jigar-f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for adding test

@jigar-f
jigar-f merged commit c2903a5 into jigar/stripe-ghost-sub-fix Aug 6, 2026
2 checks passed
@jigar-f
jigar-f deleted the atavism/stripe-ghost-sub-fix branch August 6, 2026 12:10
jigar-f added a commit that referenced this pull request Aug 6, 2026
* Update the Stripe subscription flow for Android.

* hide user-sensitive errors

* code review updates

* update UI

* code review updates

* code review updates

* Update deferred Stripe renewal and retry handling (#8952)

* Harden deferred Stripe subscription flow

* code review updates

* code review updates

---------

Co-authored-by: atavism <atavism@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants