RevenueCat / purchases-flutter

Flutter plugin for in-app purchases and subscriptions. Supports iOS, macOS and Android.
https://www.revenuecat.com/
MIT License
602 stars 168 forks source link

iOS - Full Screen paywall restore purchase doesn't dismiss #1161

Open ch-alexander opened 1 week ago

ch-alexander commented 1 week ago

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

! Doctor found issues in 1 category.



- [x] Version of `purchases-flutter`: 8.1.0 (same for purchases_flutter_ui)
- [x] Testing device version: iOS 17.5.1
- [x] How often the issue occurs - every time. Sandbox. Production unverified.
- [ ] [Debug logs](https://docs.revenuecat.com/docs/debugging) that reproduce the issue
- [x] Steps to reproduce, with a description of expected vs. actual behavior

**Other information** (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

## Describe the bug ##

iOS RevenueCat Paywall UI does not dismiss if a user restores purchases successfully. On Android, it does dismiss.

> Background, we allow users to sign in with multiple accounts. Each account may require a subscription. If a user logs in on any device, and doesn't have an active subscription, the paywall screen is presented. 

1. Log into the app as a user
2. Present full screen paywall modal to user
3. Have user subscribe to a plan successfully
4. Log out of the app user
5. Log in as a different user
6. Have the paywall presented to user again (in our case because they switched accounts)
7. Restore purchases
8. Purchase restored successfully dialog appears
9. Dismiss the dialog

![image](https://github.com/user-attachments/assets/3741876c-f429-42f7-baca-17c639cb6d89)

Expected behavior: Paywall dismisses with a restored result

Actual behavior: Paywall remains open waiting for the user to click the subscribe button or close the modal. 

## Additional context ##

- If the user attempts to subscribe again (they receive an already subscribed message) then a restored result is returned. ![image](https://github.com/user-attachments/assets/89a99f34-6549-4591-b339-85fe791df42a)
- If the user closes the paywall, the restored result is returned.
RCGitBot commented 1 week ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

Jethro87 commented 1 week ago

@ch-alexander Thanks for reporting this. Are you displaying the paywall with either of the presentPaywall methods, or are you using the PaywallView widget (documentation)? If you're using the PaywallView, have you implemented onRestoreCompleted, and if you have, is anything logged when a restore happens?

Trulsmatias commented 1 week ago

Same problem here. Using RevenueCatUI.presentPaywallIfNeeded @Jethro87

Although the paywall result is restored when manually dismissing the paywall after pressing restore purchases. It is always purchased when pressing the "buy"-button regardless if the restore purchases was pressed beforehand.

My product is not a subscription but a lifetime product if that matters.

ch-alexander commented 6 days ago

@ch-alexander Thanks for reporting this. Are you displaying the paywall with either of the presentPaywall methods, or are you using the PaywallView widget (documentation)? If you're using the PaywallView, have you implemented onRestoreCompleted, and if you have, is anything logged when a restore happens?

@Jethro87 We are using RevenueCatUI.presentPaywallIfNeeded