Skip to content

Add PaywallListener convenience prop to PaywallView components#1632

Open
rickvdl wants to merge 1 commit intorickvdl/add-purchase-logic-support-to-paywallviewfrom
rickvdl/paywall-listener
Open

Add PaywallListener convenience prop to PaywallView components#1632
rickvdl wants to merge 1 commit intorickvdl/add-purchase-logic-support-to-paywallviewfrom
rickvdl/paywall-listener

Conversation

@rickvdl
Copy link
Member

@rickvdl rickvdl commented Feb 26, 2026

Summary

  • Adds PaywallListener and PurchaseResumable interfaces matching the Capacitor SDK definitions
  • Adds listener prop to PaywallView and PaywallFooterContainerView as a convenience alternative to passing individual callback props
  • Individual callback props take precedence over listener callbacks when both are provided
  • No native changes required — purely TypeScript-level convenience

Related PRs

Test plan

  • Verify TypeScript compiles without errors
  • Verify API testers pass type-checking
  • Test listener prop on PaywallView — purchase/restore callbacks fire
  • Test that individual callback props override listener callbacks
  • Test that omitting listener doesn't regress existing behavior (existing "Go to Paywall Screen" works as before)

@rickvdl rickvdl marked this pull request as ready for review February 26, 2026 15:21
@rickvdl rickvdl requested a review from a team as a code owner February 26, 2026 15:21
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! It should make adding more callbacks much nicer as well in the future. Just a comment about deprecating the older APIs.

* Individual callback props take precedence over listener callbacks.
*/
listener?: PaywallListener;
onPurchaseStarted?: ({packageBeingPurchased}: { packageBeingPurchased: PurchasesPackage }) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we deprecate these other methods in favor of using the listener? I think keeping both can be very confusing, that way we can move people to use our preferred approach (which I think should be the listener).

* completion, restoration, and errors.
* Individual callback props take precedence over listener callbacks.
*/
listener?: PaywallListener;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I do wonder whether we should add it to the footer... But I think it's ok to keep it. Same comment about deprecating older callbacks in favor of the listener though.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants