Skip to content

Add PurchaseLogic support to PaywallView#715

Merged
rickvdl merged 6 commits into
mainfrom
rickvdl/add-purchase-logic-support-to-paywallview
Mar 10, 2026
Merged

Add PurchaseLogic support to PaywallView#715
rickvdl merged 6 commits into
mainfrom
rickvdl/add-purchase-logic-support-to-paywallview

Conversation

@rickvdl
Copy link
Copy Markdown
Member

@rickvdl rickvdl commented Mar 4, 2026

Summary

  • Adds PaywallPurchaseLogic interface and PurchaseLogicResult sealed class, allowing developers to provide custom purchase and restore logic to PaywallView
  • Adds purchaseLogic property to PaywallOptions
  • Implements iOS support via PaywallProxy + HybridPurchaseLogicBridge
  • Implements Android support via performPurchase/performRestore lambdas
  • Adds SamplePurchaseLogic to the sample app with a compile-time purchasesAreCompletedByMyApp flag
  • Adds API tester coverage for the new public API surface

Related PRs

Test plan

  • Build and run on iOS simulator — verify paywall displays and purchase logic button appears
  • Enable purchasesAreCompletedByMyApp in Defaults.kt and verify custom purchase logic is invoked
  • Build and run on Android — verify paywall displays with purchase logic support
  • Verify standard paywall flow (without purchase logic) is unaffected

@rickvdl rickvdl added pr:feat A new feature pr:RevenueCatUI A change to the RevenueCatUI library labels Mar 4, 2026
@rickvdl rickvdl marked this pull request as ready for review March 4, 2026 08:58
@rickvdl rickvdl requested a review from a team as a code owner March 4, 2026 08:58
Copy link
Copy Markdown
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.

Looking great! I just noticed that the API we've added might be wrong since we've been adding a new one in Android native 😱... I think it would be great to use that same API so it's easier to extend it now that it's not merged. Changing that without breaking changes later would be a pain :(

@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch 3 times, most recently from 7e339ac to 107296c Compare March 6, 2026 13:20
Copy link
Copy Markdown
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.

Just a comment from an issue we have in android, but looking great!

rickvdl added 5 commits March 9, 2026 16:25
Adds the ability for developers to provide custom purchase and restore
logic to PaywallView via the new PaywallPurchaseLogic interface, matching
the implementations in Flutter (PR #1657) and React Native (PR #1607).

- Add PaywallPurchaseLogic interface and PurchaseLogicResult sealed class
- Add purchaseLogic property to PaywallOptions
- Implement iOS bridge via PaywallProxy + HybridPurchaseLogicBridge
- Implement Android support via performPurchase/performRestore lambdas
- Add SamplePurchaseLogic to the sample app with compile-time flag
- Add API tester for the new public API surface
- Change performPurchase to accept PaywallPurchaseLogicParams instead of
  plain Package, matching Android's PaywallPurchaseLogicParams (wrapping
  package, product change info, and subscription option)
- Change performRestore to accept CustomerInfo parameter
- Change PurchaseLogicResult from sealed interface to abstract class for
  future extensibility without breaking changes
- Change Error.errorMessage to Error.errorDetails (PurchasesError?) to
  match Android's richer error type
- Add PaywallPurchaseLogicParams class with Builder
- Update Android/iOS wrappers, sample app, and API tester
- Regenerate API dump
…walls

Use PaywallProxy + createPaywallViewWithParams for both standard and
custom-purchase-logic paywalls, eliminating the separate code path that
used RCPaywallViewController directly. The footer path remains unchanged
since PaywallProxy doesn't support PaywallViewCreationParams for footers.
@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch 3 times, most recently from cb8e620 to bfa1445 Compare March 9, 2026 15:54
@rickvdl rickvdl requested a review from tonidero March 9, 2026 16:03
Copy link
Copy Markdown
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.

All the code makes sense to me. Amazing job! 🚢

@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch from bfa1445 to 99372f8 Compare March 10, 2026 06:39
@rickvdl rickvdl enabled auto-merge (squash) March 10, 2026 07:16
@rickvdl rickvdl merged commit 2621220 into main Mar 10, 2026
12 checks passed
@rickvdl rickvdl deleted the rickvdl/add-purchase-logic-support-to-paywallview branch March 10, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature pr:RevenueCatUI A change to the RevenueCatUI library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants