Skip to content

Fix: return ProductAlreadyPurchasedError when purchasing an already-active subscription on a paywall#3699

Draft
vegaro wants to merge 3 commits into
mainfrom
fix/paywall-same-product-already-subscribed
Draft

Fix: return ProductAlreadyPurchasedError when purchasing an already-active subscription on a paywall#3699
vegaro wants to merge 3 commits into
mainfrom
fix/paywall-same-product-already-subscribed

Conversation

@vegaro

@vegaro vegaro commented Jul 2, 2026

Copy link
Copy Markdown
Member

Slack thread

On an Android paywall with proration modes configured, tapping purchase on a subscription the user already actively owns (same product + same base plan) opens the Google Play billing flow just to fail. The product-change path errors with "One or more of the arguments provided are invalid", and a plain purchase is rejected by Google Play as ITEM_ALREADY_OWNED.

After this change the SDK detects this case client-side and surfaces PurchasesErrorCode.ProductAlreadyPurchasedError without opening the billing flow at all. The error goes through the normal paywall purchase-error path, so developers already handling purchase errors receive it on the same callback as any real purchase failure.

Note: re-enabling auto-renew on a cancelled-but-still-active subscription is not possible programmatically. Google treats that as a restore, only available via the Play Store Resubscribe button or the server-side API, so erroring out is the correct behavior here.

claude and others added 3 commits June 29, 2026 10:29
…ption on paywall

When a user taps purchase on a paywall package for a subscription they
already actively own (same product id AND same base plan id), launching
the Google billing flow fails with ITEM_ALREADY_OWNED, and the
proration/product-change path errors with "arguments invalid".

Detect this exact-match case client-side in ProductChangeCalculator and
throw a PurchasesException with ProductAlreadyPurchasedError. This
propagates through PaywallViewModel.performPurchase's existing
PurchasesException catch, so the developer's onPurchaseError callback and
the actionError state receive it on the same path as real purchase
failures, and no billing flow is launched.

Same product with a different base plan keeps its existing behavior (no
error), and a different product keeps going through the proration path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JArdd49GRtykeca3meB8RA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants