Skip to content

Create PaywallPurchaseContext to PurchaseLogic for product changes and offers#3129

Open
vegaro wants to merge 12 commits intomainfrom
cesar/myapp_product_change
Open

Create PaywallPurchaseContext to PurchaseLogic for product changes and offers#3129
vegaro wants to merge 12 commits intomainfrom
cesar/myapp_product_change

Conversation

@vegaro
Copy link
Member

@vegaro vegaro commented Feb 23, 2026

This is a followup from #3062 (comment)

  • Introduces PaywallPurchaseLogic and PaywallPurchaseLogicWithCallback. New interfaces extending the existing PurchaseLogic/PurchaseLogicWithCallback, enabling developers using MY_APP mode to handle subscription upgrades/downgrades and promotional offers from paywalls.
  • New implementations receive a PaywallPurchaseContext containing the package, an optional ProductChange, and an optional SubscriptionOption.
  • Deprecates PurchaseLogic and PurchaseLogicWithCallback in favor of the new interfaces. Existing implementations continue to work without changes.
  • Developers adopting PaywallPurchaseLogic only need to implement performPurchase(activity, context). No need to implement the old performPurchase(activity, rcPackage).

Note

Medium Risk
Touches purchase execution paths for MY_APP mode and changes public API types, so regressions could break custom purchase integrations despite deprecation shims and added tests.

Overview
Adds a new custom purchase API for paywalls: PaywallPurchaseLogic (plus PaywallPurchaseLogicWithCallback) and a PaywallPurchaseLogicParams object that carries the Package plus optional product-change (oldProductId/ReplacementMode) and SubscriptionOption offer details.

Updates all paywall entry points (PaywallOptions, PaywallDialogOptions, PaywallActivityLaunchOptions, PaywallView) to accept PaywallPurchaseLogic instead of PurchaseLogic, and deprecates the old PurchaseLogic/PurchaseLogicWithCallback while keeping them source-compatible via an adapter implementation.

Wires the new params through PaywallViewModel when PurchasesAreCompletedBy.MY_APP, and expands tests + api-tester coverage to validate the new context is passed for product changes and resolved offers; public API surface (api.txt) is updated accordingly.

Written by Cursor Bugbot for commit 4627605. This will update automatically on new commits. Configure here.

@vegaro vegaro added the pr:feat A new feature label Feb 23, 2026
@vegaro vegaro requested a review from tonidero February 23, 2026 12:35
@vegaro vegaro marked this pull request as ready for review February 23, 2026 12:35
@vegaro vegaro requested a review from a team as a code owner February 23, 2026 12:35
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

Some thoughts on the API. Not ideal to have 2 such similarly named types... but I think it might be the better option so let's go with this.

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.22%. Comparing base (992bf06) to head (c2e5fa7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3129   +/-   ##
=======================================
  Coverage   79.22%   79.22%           
=======================================
  Files         347      347           
  Lines       13911    13911           
  Branches     1884     1884           
=======================================
  Hits        11021    11021           
  Misses       2109     2109           
  Partials      781      781           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@vegaro vegaro requested a review from tonidero February 25, 2026 15:50
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

Nice one! I think this is probably the cleanest 🫶
I guess we need to do similar changes in iOS + hybrids right? One step at a time 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants