Skip to content

Add custom PurchaseLogic support to PaywallView component#1607

Merged
rickvdl merged 9 commits intomainfrom
rickvdl/add-purchase-logic-support-to-paywallview
Feb 27, 2026
Merged

Add custom PurchaseLogic support to PaywallView component#1607
rickvdl merged 9 commits intomainfrom
rickvdl/add-purchase-logic-support-to-paywallview

Conversation

@rickvdl
Copy link
Member

@rickvdl rickvdl commented Feb 17, 2026

Summary

  • Adds support for passing custom purchaseLogic (performPurchase / performRestore) to the Paywall and PaywallFooterView components on iOS
  • When purchaseLogic is provided, the paywall delegates purchase and restore operations to the app via an async bridge (HybridPurchaseLogicBridge) instead of using RevenueCat's default implementation
  • Used when purchasesAreCompletedBy is set to MY_APP

Dependencies

To Do

  • iOS
  • Android

@rickvdl rickvdl requested a review from a team as a code owner February 17, 2026 12:47
@rickvdl rickvdl added the pr:feat A new feature label Feb 17, 2026
@rickvdl rickvdl changed the title [iOS] Add custom PurchaseLogic support to PaywallView component Add custom PurchaseLogic support to PaywallView component Feb 17, 2026
@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch 2 times, most recently from ec4468d to 9f1c81a Compare February 18, 2026 08:41
@tonidero
Copy link
Contributor

Haven't reviewed this yet, but just a note that I don't think we should release this API with only iOS support. Ideally we can release it for both simultaneously 🙏

@rickvdl
Copy link
Member Author

rickvdl commented Feb 18, 2026

Haven't reviewed this yet, but just a note that I don't think we should release this API with only iOS support. Ideally we can release it for both simultaneously 🙏

Sorry should have made that more clear, but that's the plan indeed. Working on Android support at the moment :) Will change it to a draft to make it more explicit.

@rickvdl rickvdl changed the title Add custom PurchaseLogic support to PaywallView component Draft: Add custom PurchaseLogic support to PaywallView component Feb 18, 2026
@rickvdl rickvdl marked this pull request as draft February 18, 2026 09:57
@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch from 9f1c81a to a6dc5e5 Compare February 19, 2026 11:10
@rickvdl rickvdl changed the title Draft: Add custom PurchaseLogic support to PaywallView component Add custom PurchaseLogic support to PaywallView component Feb 19, 2026
@rickvdl rickvdl marked this pull request as ready for review February 19, 2026 11:10
@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch from a6dc5e5 to 7e15f64 Compare February 23, 2026 15:23
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.

Looking great! I think that it would be great to try to use the same API we did for Capacitor here though, so it's easier to share between the SDKs later if possible. Nothing blocking other than that 🙏

}

override fun onDropViewInstance(view: T) {
purchaseLogicBridges.remove(view.id)?.cancelPending()
Copy link
Contributor

Choose a reason for hiding this comment

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

We should test this thoroughly by showing and hiding the paywall view, both without paywall dismissal (like the developer hiding it on their own), and with paywall asking to dismiss, whether with a successful purchase or a close event. In all of these scenarios, we should make sure this instance is cleared and can be shown again later.

Just want to make sure since not fully familiar if onDropViewInstance will be called always. Hopefully it does 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

Tested onDropViewInstance cleanup on Android with debug logging across these scenarios:

Test Scenario Result
1 Normal dismiss (close button) Bridge created + cleaned up via cancelPending()
2 Re-mount (navigate back, open again) New bridge with new view ID, no stale state
3 Purchase cancel + dismiss Cleaned up properly
4 Auto-success (immediate resolve) Cleaned up after completion
5 Dismiss during in-flight purchase (5s delayed resolve) cancelPending() called before timer fires, no crash
6 Programmatic dismiss (unmount via state) Cleaned up properly

@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch from 7e15f64 to fe63548 Compare February 25, 2026 09:37
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.

I think this makes sense! Only thing is whether we might want to remove it from the Footer support, since I think it's not needed there... Not sure if it might overcomplicate things though, in which case, we could keep it.

@rickvdl rickvdl force-pushed the rickvdl/add-purchase-logic-support-to-paywallview branch from fe63548 to d82dcf8 Compare February 26, 2026 09:51
@rickvdl rickvdl requested a review from tonidero February 26, 2026 09:52
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.

Amazing job! 🚢

@rickvdl rickvdl merged commit 9005553 into main Feb 27, 2026
7 checks passed
@rickvdl rickvdl deleted the rickvdl/add-purchase-logic-support-to-paywallview branch February 27, 2026 08:27
@rickvdl rickvdl restored the rickvdl/add-purchase-logic-support-to-paywallview branch February 27, 2026 08:36
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