Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Return Paywall Results when registering for an event #21

Open
joshuadeguzman opened this issue Aug 14, 2024 · 2 comments
Open

Comments

@joshuadeguzman
Copy link

joshuadeguzman commented Aug 14, 2024

Description

Currently, an app we're building is using RevenueCat with Superwall Paywalls. So, we created a controller (inspired from the Superwall + RC example) that allows the callbacks and purchases to be synced. We register the controller delegate in a global screen/page with many sub widgets/places where a paywall can be presented.

Problem
We find it challenging for us to truly know if the user bought a subscription at the time when the paywall is presented using the handler only. We need to keep track of the interactions where (feature or section in the app) paywall was called and user was able to complete it or not.

We're aware that we can potentially get the "completed state" using subscriptionStatusDidChange, but that does not guarantee return if the subscription status was changed because of the paywall or something else (outside the app).

Proposal

The proposal is to have a handler callback if purchased has been made at the time the paywall is registered and presented:

// Initialize the handler
final handler = PaywallPresentationHandler();
handler
  ..onPresent((paywallInfo) async {
      ... (do something here)
  })
  /// Have this included in the presentation handler
  ..onComplete((paywallInfo) async {
      ... (handle when the user purchases a paywall)
  })
  ..onSkip((paywallInfo) async {
      ... (do something here)
  })
  ..onDismiss((paywallInfo) async {
      ... (do something here)
  })
  ..onError((error) {
      ... (do something here)
  })
  ..onSkip(_handlePaywallSkipReason);

// Present the paywall
await Superwall.shared.registerEvent(
  feature.identifier,
  handler: handler,
  feature: ... // In the SDK, this method is not aware of any subscription changes, it just handle the gating logic internally
);

Let me know what you think!

@apexborg
Copy link

apexborg commented Sep 6, 2024

Great idea! I'm currently facing the same issue and have come to the same conclusion — something like 'onComplete' needs to be there. Hopefully, it will be added soon.

@sethmills21
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants