Search Unity

Google Play Subscription Upgrade / Downgrade

Discussion in 'Unity IAP' started by eylulatilgan, Apr 25, 2018.

  1. eylulatilgan

    eylulatilgan

    Joined:
    Jun 7, 2013
    Posts:
    12
    I have three subscriptions; weekly, monthly and yearly. They unlock all the items in the app but monthly and weekly offers discounted prices. The thing is when I want to upgrade from weekly to monthly (or yearly) or downgrade, I see that I have two subscriptions and the old one won't be canceled. What should I do? Thanks in advance.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are looking to support this feature in the next IAP release which should be available within a few weeks.
     
  3. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Did this feature make it into 1.19.0?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    How are you planning to upgrade the subscription? Do you mean on the users Google account dashboard, or in the app? Reading your first post a bit closer, you mention "I see that I have two subscriptions and the old one won't be canceled." Where are you seeing this?
     
  5. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Imagine the customer has these options:

    ( ) Premium - Monthly
    ( ) Premium - Annual

    The annual version of the subscription would be discounted. The customer chooses Premium - Monthly, loves it, and want to save some $ and choose the Premium Annual subscription. Customer would logically go back to subscriptions and see something like:

    (x) Premium - Monthly
    ( ) Premium - Annual

    The customer would expect to be able to choose Premium - Annual and purchase it. Behind the scenes, Premium - Monthly would be cancelled and Premium - Annual would be purchased. As it is now, there seems to be no way to relate subscriptions to each other, making them mutually exclusive. Unless you manually cancel the Premium - Monthly subscription outside of your app, when you 'upgrade' to Premium Annual, you will have two subscriptions both giving you the same functionality.

    The example could have been between

    ( ) Premium
    ( ) Ultimate

    In this case, Ultimate gives some extra features above Premium. Same issue, how does a customer simply upgrade to Ultimate. It seems they need to know they need to first cancel the Premium subscription outside the app, then come back a subscribe to the other. This is workflow is horrible.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you provide a link to the Google documentation that refer to Subscription upgrade process/API that you are referring to?
     
  7. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    I'm not referring to an upgrade process/API, I haven't looked deeply into Google and Apple IAP SDKs. That's why I'm using Unity IAP. :D I see the value you are providing by making a cross platform solution for IAP, and I assume you are limited by the functionality provided by Google and Apple so I understand if there are short comings.

    My questions are coming from using Unity IAP for a while and thinking through the typical things a customer would expect to be able to do. My app is going to offer 3 subscription options:

    ( ) Basic - a free version with limited capability
    ( ) Premium - a subscription that gives more
    ( ) Ultimate- a subscription that gives the most

    Basic is the default and doesn't require a subscription. If the customer upgrades to Premium, they purchase an auto renewing subscription and off they go.

    From here the customer has three options:

    1. stay with Premium
    2. downgrade to Basic
    3. upgrade to Ultimate

    From what I can tell, there is no clear API for handling options 2 and 3.

    Option 2. downgrade to Basic
    It appears I'd need to direct the customer to the Google Play subscription website (either https://play.google.com/store/account/subscriptions to see all current subscriptions or https://play.google.com/store/accou...age=com.company.appname&sku=subscription.name to see the specific subscription). Once here the user can cancel the subscription or change the payment method. To "downgrade to Basic", the customer would needs to cancel the subscription and my app would need to detected this change. Is there a way to programmatically cancel a subscription?

    Option 3. upgrade to Ultimate
    Same basic question here. I see how to subscribe, but no means of cancelling an active subscription. My app would need to prevent the user from subscribing to Ultimate until they have cancelled the Premium subscription by going outside my app into Google Play subscription kingdom. I believe this workflow will be frustrating and confusing to customers so I'm looking for a way to make this smooth. A one click upgrade or downgrade.

    I would assume this is a common question for any app developer with an app the uses subscriptions.

    I'd really appreciate any suggestions you have.
    Thx,
    Marc
     
  8. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    I looked deeper at Apple's subscription system and I see that they have subscription groups which seems to be exactly what I'm looking for. They handle the upgrade/downgrade between subscriptions, even handle the prorating of costs if you change mid-subscription period which is awesome. The only thing I don't see if a programmatic way to cancel. Do you know if this possible for Apple subscriptions?

    It seems Google Play subscription system lacks subscription groups which is exactly what I'm looking for. This means my app will need to do things much differently if they are subscribing on an Android. :( In addition to the confusing 'Cancel before you switch subscriptions' workflow, the customer needs to be aware of getting double charged if they cancel mid-month and immediately choose another subscription type. Unlike Apple, the customer won't get a prorated refund for the cancelled subscription and will be fully charged for the upgraded subscription - double charged for a period of time.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    In discussing with the engineering team here, we already support subscription groups for iOS. Apple will automatically cancel-and-upgrade the subscription when the user purchases the premium subscription. We plan to add similar Google support in the next IAP release.
     
  10. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx, I figured Apple would work. But still looking for programmatic cancelling.

    After some digging I see the Google API docs about handling upgrades/downgrades and programmatic cancelling. I'm glad it's there but adds quite a bit of complexity to my Unity app.

    Any idea on timing of a new version of IAP with this functionality? Thx
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No specific ETA at this time, but I would estimate 2-4 weeks for 1.20 to be released.
     
  12. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    I see that 1.20.0 was just released and the release notes say "Support upgrade/downgrade Subscription Tiers for GooglePlayStore." I haven't seen any specific changes to the API. Is there anything we need to do to take advantage of this new support? Thx, Marc
     
  13. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Awesome turn around on this support BTW.
    Thx a ton, Marc
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are planning to post additional 1.20 documentation shortly.

    For upgrade/downgrade:

    Code (CSharp):
    1. IGooglePlayStoreExtensions m_GooglePlayStoreExtensions;
    2. m_GooglePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    3. Product oldProduct = m_Controller.products.WithID("oldProductID");
    4. Product newProduct = m_Controller.products.WithID("newProductID");
    5. Action<string, string> googlePlayCallback = new Action<string, string>(m_GooglePlayStoreExtensions.UpgradeDowngradeSubscription);
    6. SubscriptionManager.UpdateSubscription(newProduct, oldProduct, "sampleDeveloperPayload", appleStoreCallback, googlePlayCallback);
     
    AUEzzat likes this.
  15. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Awesome, will give it a shot. Thx
     
  16. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    It works! I have successfully upgraded and downgraded existing subscriptions.
    I hope you could help me answer these questions:
    1. is there a way to get the result of the upgrade, similar to purchasing a new subscription: success, failure, user canceled, etc?
    2. is there a way to fully refresh the product subscription info. As it stands, it seems that this info is cached in UnityIAP and only particular items get updated. After I upgrade/downgrade, both the old and new subscriptions reported through UnityIAP(by calling SubscriptionManager.getSubscriptionInfo()) appear to be subscribed to. Both are still auto-renewing and have renewal dates. However, if I close my app and reopen it, I only see the new subscription as active. I can't figure out how to refresh the old subscription info without an app restart. I see a similar thing if I manually cancel a subscription on the App Store and look a my app. I've tried using m_StoreController.FetchAdditionalProducts() but doesn't pick up cancelation or subscription info for the subscription transitioned away from during the upgrade/downgrade process.
    Thx for your help.
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This may help:

    IAP 1.20 newly added functionalities documentation

    Sample code for Upgrade/Downgrade subscription product on Google Play Store:

    Code (CSharp):
    1. private IGooglePlayStoreExtensions m_GooglePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    2. Product oldProduct = m_Controller.products.WithID("oldProductID");
    3. Product newProduct = m_Controller.products.WithID("newProductID");
    4. Action<string, string> googlePlayCallback = new Action<string, string>(m_GooglePlayStoreExtensions.UpgradeDowngradeSubscription);
    5. SubscriptionManager.UpdateSubscription(newProduct, oldProduct, "sampleDeveloperPayload", null, googlePlayCallback);
    To use this API correctly, the oldProduct should be a subscription product that has been purchased, the newProduct should be a subscription product that has been added to IAP but not been purchased. The SubscriptionManager.UpdateSubscription API will update the oldProduct to the newProduct on GooglePlay store.

    Sample code for getting products’ skuDetails on GooglePlay store:

    Code (CSharp):
    1. private IGooglePlayStoreExtensions m_GooglePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    2. Dictionary<string, string> GooglePlayStoreProductSKUDetailsJson = m_GooglePlayStoreExtensions.GetProductJSONDictionary();
    The GooglePlayStoreProductSKUDetailsJson is a dictionary of the product skuDetails. The key is the product id and the value is a JSON string of the product skuDetails retrieved from GooglePlay store.

    A sample skuDetails JSON string is like:

    Code (CSharp):
    1. {"productId":"sub5","type":"subs","price":"$3.99","price_amount_micros":3990000,"price_currency_code":"USD","subscriptionPeriod":"P1M","title":"sub5 (demo4)","description":"sub5"}
     
  18. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx for the extra info about retrieving the SKU details. I assume this is addressing the second question about how to fully refresh the non-active subscription info. I'll try it.

    Any word on the first question regarding getting the upgrade/downgrade result? any callback I can monitor?

    Thx
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    In the code above, it mentions both appleStoreCallback and googlePlayCallback. I'm also checking on the return code type of SubscriptionManager.UpdateSubscription
     
    Last edited: Jul 3, 2018
  20. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx. The return of SubscriptionManager.UpdateSubscription is void and is an async function so it immediately returns. The googleCallback is defined with the Google extension function so not something that helps me determine the result. I could wrap the google extension function and get myself into the processing path, but not sure that gets me any farther in knowing what happened. Seems like there would be a clear way to get the result, like PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) or OnPurchaseFailed(Product product, PurchaseFailureReason failureReason), or something similar. Thx.
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate as to why the mentioned callback would not work for you

    SubscriptionManager.UpdateSubscription(newProduct, oldProduct, "sampleDeveloperPayload", null, googlePlayCallback);
     
  22. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Ok, I'll be as clear as I can.

    Most asynchronous functions with callbacks that I've used call the callback when the operation is complete or failed.

    For example:

    void AsynchronousFunc(int param1, int param2, System.Action<ResultStruct> callback);

    Calling the function, you can provide a separate callback function like:

    AsynchronousFunc(1, 2, MyCallback);

    void MyCallback(ResultStruct result)
    {

    if (result.exception != null)
    {

    Debug.Log("AsynchronousFunc failed");
    Debug.LogException(result.exception);
    return;
    }

    Debug.Log("AsynchronousFunc completed successfully");
    // do something with the results...
    }

    Or you can use an anonymous function to do the same thing like:

    AsynchronousFunc(1, 2, result =>
    {

    if (result.exception != null)
    {

    Debug.Log("AsynchronousFunc failed");
    Debug.LogException(result.exception);
    return;
    }

    Debug.Log("AsynchronousFunc completed successfully");
    // do something with the results...
    });

    The function SubscriptionManager.UpdateSubscription() has two callbacks that are not used to indicate the results of the operation. They appear to be called immediately after UpdateSubscription() determines whether it's running on a Apple or Google Play device. And it assumes the callback function is going to call the appropriate extension function. For Google, it assume IGooglePlayStoreExtensions.UpgradeDowngradeSubscription() will be called to do the upgrade/downgrade process.

    To make sure, I created my own callback that simply calls IGooglePlayStoreExtensions.UpgradeDowngradeSubscription() and I saw this happening. This extension function is also an async function so it returns immediately with no apparent way to get the result of the upgrade/downgrade.

    In the system log, I see that UnityIAP is getting the result because I see the following:

    On successful upgrade/downgrades:

    I/UnityIAP: onActivityResult
    Successful resultcode from purchase activity.
    Purchase data: {"orderId":"...

    On user cancel:

    I/UnityIAP: Purchase canceled - Response: 1:User Canceled

    But I don't see any related activity in my app, like I would when purchasing a subscription. Without a way to get the result of the operation, it makes integrating this new feature quite unwieldy. I haven't been able to figure out a clean workaround to remedy this shortcoming.

    Does this make sense?
     
    Last edited: Jul 4, 2018
    lucky0wl and Nickok like this.
  23. lucky0wl

    lucky0wl

    Joined:
    Mar 26, 2016
    Posts:
    1
    Yeap, marcz88
    We need that functionality too. Without those callbacks we can't process server-side-verification like with IStoreListener. Apple Subscription Groups works fine through InitiatePurchase, but Android...
     
    Nickok likes this.
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @marcz88 Thank you for the detailed response (and your patience!). I will follow up with the IAP team and keep you posted.
     
    lucky0wl likes this.
  25. Nickok

    Nickok

    Joined:
    Sep 23, 2013
    Posts:
    2
    @JeffDUnity3D Forgive me for my importunity, but we also need this functionality. Can you tell when to wait for it? Thank you
     
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There is no specific ETA, but I might expect a 6-7 week timeframe for version 1.21. I'll update this thread as I hear more specifics.
     
    Last edited: Jul 12, 2018
  27. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx for reply and ETA.
     
  28. Deleted User

    Deleted User

    Guest

    Hi @lucky0wl, i'm use Subscription Groups, but when i InitiatePurchase a production call back is fail with message is unknow . you can works fine with callback when upgrade/downgrade in apple ?
     
    Last edited by a moderator: Aug 2, 2018
  29. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hello, I see the 1.21.0 update just came out but no mention of any fixes for Google Play subscription upgrade/downgrade issue we described above. Were there any non-public changes regarding these issues?
    Thx
     
    Last edited: Aug 16, 2018
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There were no bug fixes in the 1.21.0 release. The next release 1.21.1 that should contain the updates is scheduled for mid-September.
     
  31. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx for the update but really disappointed it wasn't included in 1.21.0.
    I want to make sure it's understood by Unity product management that the Google Play upgrade/downgrade feature in 1.20.0 is not usable as it stands. To me, it seems like it was released halfway implemented.
     
  32. unity_fWN0bIHMPW3fkw

    unity_fWN0bIHMPW3fkw

    Joined:
    Feb 6, 2018
    Posts:
    5
    In relation to this problem; I'd like to ask for a proper documentation for the following methods in SubscriptionManager:

    Code (CSharp):
    1.         public static void UpdateSubscription(Product newProduct, Product oldProduct, string developerPayload, Action<Product, string> appleStore, Action<string, string> googleStore);
    2.         public static void UpdateSubscriptionInAppleStore(Product newProduct, string developerPayload, Action<Product, string> appleStoreUpdateCallback);
    3.         public static void UpdateSubscriptionInGooglePlayStore(Product oldProduct, Product newProduct, Action<string, string> googlePlayUpdateCallback);
    Right now I'm calling initiatePurchase during the upgrade/downgrade and it's returning
    Code (CSharp):
    1. StoreSpecificPurchaseErrorCode.SKErrorUnknown
    even though it was successfully downgraded (We verify the purchase via server-side for now). So I'm guessing instead of initiatePurchase, I should be calling the UpdateSubscription? Is that right? And what does the string parameter inside
    Code (CSharp):
    1. appleStoreUpdateCallback, googlePlayUpdateCallback
    mean? Is it an error message of some sort?

    Thanks!
     
  33. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  34. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    I'm glad I'm not the only one scratching their head on this. If you take a look at few pages up, I explain what I learned about these callbacks. They aren't traditional callbacks that are executed to report status or a result. They appear to be used by the UpgradeSubscription* functions merely to access the appropriate extension function. For google play upgrade/downgrade, you need to pass in 'googlePlayCallback' as defined below:

    private IGooglePlayStoreExtensions m_GooglePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    Action<string, string> googlePlayCallback = new Action<string, string>(m_GooglePlayStoreExtensions.UpgradeDowngradeSubscription);


    To see when the callback is executed, I created my own callback which just called the PlayStore extension UpgradeDowngradeSubscription function. It appears to be called immediate after you call the Upgrade function, never again after that. So, currently no clear way to know whether the upgrade/downgrade succeeded or failed.
     
    Last edited: Aug 29, 2018
    unity_fWN0bIHMPW3fkw likes this.
  35. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx Jeff, unfortunately there is nothing in that particular documentation about UpgradeDowngradeSubscription(). Do you know if the team is working to resolve this issue?

    I decided to use UnityIAP because I thought it was going to simplify integration with the App stores. I believe it has helped but it also has some serious issues and odd behavior causing lots of pain. I'm seriously considering backing it out and going at it on my own.

    The API has some really clunky parts, for instance (in no particular order):

    1. Calling UnityPurchasing.Initialize() when user isn't logged into the App Store, even though you've passed a OnSuccess and OnFailure callback you get no notification from IAP at all. An app that expects to receive an OnSuccess or OnFailure response just sits there waiting. Looking at the system console you can see Unity IAP doing retries after backing off X2 after each failure. I waited for 15 minutes before giving up. Why not just return OnFailure with an error code so the app could inform the user they need to login to the App Store? or get connected to the internet again? As app devs, we are left guessing and writing code to work around the lack of response.

    2. No way to fully refresh the product subscription info. After I upgrade/downgrade, both the old and new subscriptions reported through UnityIAP(by calling SubscriptionManager.getSubscriptionInfo()) appear to be subscribed to. Both appear to still be auto-renewing and have renewal dates. However, if I close my app and reopen it, I only see the new subscription as active. I can't figure out how to refresh the old subscription info without an app restart. I see a similar thing if I manually cancel a subscription on the App Store and look a my app. I've tried using m_StoreController.FetchAdditionalProducts() but doesn't pick up cancelation or subscription info for the subscription transitioned away from during the upgrade/downgrade process.

    3. The AppleExtensions RestoreTransactions() function callbacks lack clarity on an end result. Maybe I just don't have enough info on this function but from what I can tell, this function has a callback that is called to indicate a restore had begun. I assume this means that we've contacted the App Store and are ready to start retrieving transactions. Not sure why this callback is necessary at this time since I'd expect this callback when the entire function is complete. However I would prefer more info than less so I'll let this go. After receiving this "all is ok so far" callback, you can then expect zero or more ProcessPurchase() messages. There is no clear end to this, only the lack of any additional ProcessPurchase() messages. It's unclear how long a dev should wait before deeming this process complete. What if the network slowed halfway through the restore, what if there was an error midway through, is that reported anywhere?

    4. UpgradeDowngradeSubscription() provides no result. Would expect something similar to UnityPurchasing.Initialize() with OnSuccess and OnFailure callbacks.

    I really wish Unity IAP API was more consistent and robust.
     
    unity_fWN0bIHMPW3fkw likes this.
  36. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @marcz88 Regarding 1) IAP does not require that you be logged into the App Store during initialization. 2) We may include this feature in a future release 3) the callback is triggered upon completion

    Code (CSharp):
    1. m_AppleExtensions.RestoreTransactions(OnTransactionsRestored);
    2. /// <summary>
    3. /// This is will be called after a call to IAppleExtensions.RestoreTransactions().
    4. /// </summary>
    5. private void OnTransactionsRestored(bool success)
    6. {
    7.         Debug.Log("Transactions restored.");
    8. }
    4) will should be addressed in the next release mid-Sept
     
  37. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hi Jeff, thx for the info on each item. I need to clarify a few things

    After reviewing my notes about this issue, I realized the issue isn't associated with not being logged in to the AppStore - apologies for the confusion. However, the behavior described is there when the network is not available. In my case, I have a dialog that a user can access to view and edit the current subscription. When the dialog is opening, I initialize and retrieve the current subscription information. To do so, I call UnityPurchasing.Initialize(). If the user has a network connection, the info is retrieved and the dialog is displayed. If no network, OnInitialized() and OnInitializeFailed() are not called and my app spins. In the app log I see this repeat until the network connection is restored:

    ...
    08-29 15:24:36.051 7239-7295/? I/UnityIAP: Querying owned items, item type: inapp
    Package name: com.myco.myapp
    Calling getPurchases with continuation token: null
    08-29 15:24:36.062 7239-7295/? I/UnityIAP: Owned items response: 0
    Continuation token: null
    Querying SKU details.
    08-29 15:24:36.131 7239-7295/? I/UnityIAP: getSkuDetails() failed: 6:Error
    onQueryInventoryFinished: false
    Error refreshing inventory (querying prices of items). (response: 6:Error)
    Failed to Query inventory. UnityIAP will automatically retry in 300000ms
    QueryInventory: 4
    08-29 15:24:36.132 7239-7295/? I/UnityIAP: invoking callback
    ...


    I noticed the log has "invoking callback". Can you tell me what this callback is for and if it's reporting the network issue how can I register to receive it? Thx.

    For now, I've added an arbitrary timeout for the dialog to give up and show an error message.
     
  38. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You should check for network connectivity separately, prior to Initializing IAP. There is no callback to check for a connection.
     
  39. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    I'd think this would at least be broken out into a bug and a feature, or two bugs. BUG#1 After you update/downgrade, the new subscription is updated with proper info, the old subscription still reports same info it had before the call even though it's now cancelled.
     
    Last edited: Aug 29, 2018
  40. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Same issue, there is no refresh of the receipts. But thank you for the comments.
     
  41. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    That's not the answer I was hoping for. :D That's a workaround. What should we do when the networks is up but the App Store isn't responding?
    Most APIs that traverse a network return an error code if the network is down. My app puts up a nice NETWORK NOT AVAILABLE banner until it's back but I don't check for network connectivity before every function that uses a network.
     
  42. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx for this info, it definitely clarifies it.

    I found the source of my confusion. There is sample code in the Integrating Unity IAP tutorial (https://unity3d.com/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game) with this:

           
    // Fetch the Apple store-specific subsystem.
    var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
    // Begin the asynchronous process of restoring purchases.
    // Expect a confirmation response in
    // the Action<bool> below, and ProcessPurchase if there are
    // previously purchased products to restore.
    apple.RestoreTransactions((result) => {
    // The first phase of restoration. If no more responses are received
    // on ProcessPurchase then no purchases are available to be restored.
    Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
    });


    Might be good to clarify these comments so others new to IAP don't have the same confusion.
     
  43. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thank you! Getting this and #2 would make the Google UpgradeDowngradeSubscription() function complete.
     
  44. Deleted User

    Deleted User

    Guest

    @JeffDUnity3D use Subscription Groups, but when i use InitiatePurchase to purchase a pack in same subscription group, purchase success but unity return fail with reason is Unknown.
    ex:
    I set pack1 and pack2 in same group on ios. at first i subscriber pack1, then i subscriber pack2. purchase success, but unity iap return " PurchaseFailureReason Unknown"
     
    Last edited by a moderator: Sep 19, 2018
  45. Deleted User

    Deleted User

    Guest

    @JeffDUnity3D Now i look up 2 problem on plugin v1.21
    1. Android upgrade/downgrade have no call back
    2. iOS upgrade/downgrade success but return purchase fail unknow.
    please check it. thank you
     
  46. Alex_MaDi

    Alex_MaDi

    Joined:
    Sep 6, 2016
    Posts:
    2
    @datvt2236 I have the same issue with iOS auto renewable subscription purchasing two items inside the same group.
    I saw, validating App Store receipt, the result is fine. At the end of the subscription period you can see update your subscription with the new period.

    I am a little bit confuse about how to Upgrade/Downgrade Android subscriptions and if it's necessary call the same function (UpgradeDowngradeSubscription or SubscriptionManager.UpdateSubscriptionInAppleStore ?) for iOS.

    Thank you
     
  47. Deleted User

    Deleted User

    Guest

    @Alex_MaDi Yes, but unity iap return faile with unknown reason, so i don't know player confirm update subs or not

    Thank you
     
  48. Alex_MaDi

    Alex_MaDi

    Joined:
    Sep 6, 2016
    Posts:
    2
  49. Deleted User

    Deleted User

    Guest

    Hi @JeffDUnity3D. i'm using unity iap 1.20.1. when i use Google UpgradeDowngradeSubscription() and user cancel update. expect a message cancel will show. but many time i can't get fail reason. i debug and got a exception.
    could you check it


    Code (CSharp):
    1. KeyNotFoundException: The given key was not present in the dictionary.
    2. 11-02 11:28:44.071 16026 16042 E Unity   :   at System.Collections.Generic.Dictionary`2[System.String,System.Object].get_Item (System.String key) [0x00000] in <filename unknown>:0
    3. 11-02 11:28:44.071 16026 16042 E Unity   :   at UnityEngine.Purchasing.JSONSerializer.DeserializeFailureReason (System.String json) [0x00000] in <filename unknown>:0
    4. 11-02 11:28:44.071 16026 16042 E Unity   :   at UnityEngine.Purchasing.JSONStore.OnPurchaseFailed (System.String json) [0x00000] in <filename unknown>:0
    5. 11-02 11:28:44.071 16026 16042 E Unity   :   at UnityEngine.Purchasing.ScriptingUnityCallback+<>c__DisplayClass6_0.<OnPurchaseFailed>b__0 () [0x00000] in <filename unknown>:0
    6. 11-02 11:28:44.071 16026 16042 E Unity   :   at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <filename unknown>:0
     

    Attached Files:

  50. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @datvt2236 You mention "many times", does it happen every time or occasionally? We will investigate.