Purchase Token data is same after i cancelled the subscription in Flutter

Viewed 153

Hi i am new to flutter and i have integrated Auto Renewal subscription in flutter using this dependency. https://pub.dev/packages/flutter_inapp_purchase

I have done sandbox Yearly auto renewal subscription so it will auto renew at every 30 minutes a maximum of six times in sandbox and this works fine.

Issue i am facing Subscribed userA@gmail.com at 1:00 PM so it will renews at every 30 minutes and i logout userA@gmail.com from my app and i logged in with userB@gmail.com and try to Subscribe/Restore i am getting the valid purchased token which actually associated with userA@gmail.com

Does the scenario will be same in Production mode or will it give error in production mode?

If production mode scenario is same as sandbox then how can i manage it?

Thanks in advance

1 Answers

On the package page, they say that you should disconnect the billing service once you're done with it, or it will keep running in the background.

I'm not sure exactly how the plugin works, but it's likely that even if you logout, the billing service keeps running with the previous user's session.

So, what you should do is call await FlutterInappPurchase.instance.endConnection; whenever you logout, and call await FlutterInappPurchase.instance.initConnection; again with the new user.

The part of the package docs where they talk about this: enter image description here

Related