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

in_app_purchase plugin - Auto-Renewable Subscription never expires in Sandbox #36682

Open
zaidman opened this issue Jul 22, 2019 · 9 comments
Open
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: in_app_purchase Plugin for in-app purchase P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@zaidman
Copy link

zaidman commented Jul 22, 2019

I've setup an Auto-Renewable Subscription, and was successfully able to purchase it using my sandbox user account (on an actual device).

The problem is that unlike what is described here (Testing Subscription: https://medium.com/swift-india/auto-renewable-subscriptions-for-ios-3a4068f11acd), the subscription doesn't expire. I've waited for more than 2 hours, terminated the app, uninstalled and re-installed it - nothing helped...

@pbouttier
Copy link

Hi,

I'm interested to know how do you set up your auto renewal subsciprition. I try also to set up this, with buy non consumable, but with or without the sandbox account, i have no error or message and nothing append when i pass the purchase method.

To the second question, with sandbox account, the management of the subscription is different from a classic account ? If not maybe in settings you can manage this.

@zaidman
Copy link
Author

zaidman commented Jul 24, 2019

I've followed the following tutorial and just setup a "normal" subscription (AppStore):
https://fireship.io/lessons/flutter-inapp-purchases

At first, I got exceptions inside the plugin itself, when I called the queryPastPurchases method, see here: https://stackoverflow.com/questions/57133835/flutter-getting-an-exception-when-calling-querypastpurchases-in-app-purchase-pl

It doesn't happen any more, not sure why...
Please verify that:

  1. You test this on an actual device (and not an emulator) - since some of the methods won't work there
  2. That you are running with the latest version of Flutter, pods etc.

Using the plugin I've observed that:

  1. Buying a subscription works just fine (I can see 1 item in the purchaseResponse.pastPurchases)
  2. As documented (for sandbox users), after 5 minuets it seems like there's an automated renewal (I can see 2 items in the purchaseResponse.pastPurchases)
  3. After 5 more minuets I can see another renewal and so on, until there's a total of 5 subscriptions
  4. But then - I can see 1 subscription, where I expect to see 0 (no active subscriptions). See here: https://stackoverflow.com/questions/57164366/flutter-how-to-use-in-app-purchase-plugin-to-implement-subsciptions

Not sure if that's a bug on something I'm doing wrong.
Used the sample code (from the plugin repository) on a clean Flutter project.

If you manage to make it work - please share your workflow

@pbouttier
Copy link

Thanks you,

I miss the emulator clause, in iphone it's work nice. Not the best to debug, but better than nothing.
I follow the code and the guideline from apple, nothing special.

@BondarenkoStas BondarenkoStas added p: in_app_purchase Plugin for in-app purchase plugin labels Sep 23, 2019
@dannycortesv
Copy link

This is also happening for me, @zaidmain, did you solve it? I think we are missing docs here. Thanks.

@zaidman
Copy link
Author

zaidman commented Oct 29, 2019

@dannycortesv
Since then I've learned that subscription is quite a complicated issue: you need to validate a receipt against Apple/Google servers (and you can't do that locally), which is quite a pain if you're not using the native libraries (google for "validate subscription receipt).
After doing some tests, I've ended up using revenuecat (read this: https://www.revenuecat.com/2018/05/22/ios-subscriptions-are-hard).
Quite happy with them :)

@dannycortesv
Copy link

@dannycortesv
Since then I've learned that subscription is quite a complicated issue: you need to validate a receipt against Apple/Google servers (and you can't do that locally), which is quite a pain if you're not using the native libraries (google for "validate subscription receipt).
After doing some tests, I've ended up using revenuecat (read this: https://www.revenuecat.com/2018/05/22/ios-subscriptions-are-hard).
Quite happy with them :)

Thanks for your help @zaidman i'm considering using revenuecat

@TahaTesser TahaTesser added customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: first party labels Mar 19, 2020
@PramodJoshi
Copy link

PramodJoshi commented Jun 21, 2020

Any update on this? I'm still experiencing this issue. I purchased the last auto-renewable subscription in Sandbox almost 24 hours ago and pastPurchases is still returning this purchase. It was my understanding that sandbox subscription expire in about 30 mins, is that not the case?

Tested on : iPad (running iOS 13.5.1)
in_app_purchase version: 0.3.4

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.2 19C57, locale en-US)
    • Flutter version 1.17.1 at /Users/user/Applications/flutter
    • Framework revision f7a6a7906b (6 weeks ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/user/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/user/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)

@zaidman
Copy link
Author

zaidman commented Jun 22, 2020

After some struggle with this mechanism, I've implemented RevenuCat solution.
Working fine for me: https://www.revenuecat.com

@lironzemingo
Copy link

Any update on this? I'm still experiencing this issue. I purchased the last auto-renewable subscription in Sandbox almost 24 hours ago and pastPurchases is still returning this purchase. It was my understanding that sandbox subscription expire in about 30 mins, is that not the case?

Tested on : iPad (running iOS 13.5.1)
in_app_purchase version: 0.3.4

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.2 19C57, locale en-US)
    • Flutter version 1.17.1 at /Users/user/Applications/flutter
    • Framework revision f7a6a7906b (6 weeks ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/user/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/user/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)

any solution for this? how to detect canceled/not renewed subscriptions?

@stuartmorgan stuartmorgan added the P3 Issues that are less important to the Flutter project label Jun 15, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
@Hixie Hixie removed the plugin label Jul 6, 2023
@flutter-triage-bot flutter-triage-bot bot added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: in_app_purchase Plugin for in-app purchase P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests

9 participants