A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Unity IAP' started by eylulatilgan, Apr 25, 2018.
@JeffDUnity3D this issue appears much time. so please check it
And now i have a problem when update subscription in android:
When a player subscribed to a pack named Pack 1 (pack 1 month, in testing environment time duration is 5 minutes) which has a duration of 5 minutes. At the 2nd minute, the player upgrades to Pack 2 and in the Google Play, the subscription displays it will renew on the 5th minute. But at the 5th minute, we notice that the subscription renew status has not changed and we do not get an email for order receipt (this email notifies about billing information). However, if the client/server call Google API for billing status, it still shows that the subscription is still active and the order ID is not changed, and the properties "expiryTimeMillis" get increased.
The player is recognized as a subscriber of pack 2 and can not re-subscribe it. We think that the player is not getting charged for Pack 2, but have no obvious clue to confirm it. There is an abnormal number for the expired time of Pack 2 attached with the player.
When purchase pack1 we get receipt with order id: GAP.xxxx-xxxx-xxxx-xxxx. after purchase pack1 we upgrade to pack2 have new order id GAP.xxxx-xxxx-xxxx-xxxx.
expect pack2 will auto-renew at the end of pack 1 with new order id: GAP.xxxx-xxxx-xxxx-xxxx..0 but pack 2 not auto-renew and order still is GAP.xxxx-xxxx-xxxx-xxxx.
However, if the client/server call Google API to check billing status expiryTimeMilis has update
Does anyone get the same problem?
@JeffDUnity3D these issues appear much of time. so please check it. thanks
@datvt2236 Are you seeing this in testing only, or in your Released app also?
It appears in testing only, we not release yet
@JeffDUnity3D I have same question with this issue.
What is default mode in GetExtension<IGooglePlayStoreExtensions>().UpgradeDowngradeSubscription?
@datvt2236 We are using "In app billing with AIDL" and the method we use to implement upgrade and downgrade is here https://developer.android.com/googl...g_reference#upgrade-getBuyIntentToReplaceSkus. And replaceSkusProrationMode is the default.
thank you for your information
@JeffDUnity Do you have infor about this issue?
@datvt2236 Are you able to catch the exception in a Try/Catch block? We will check here also.
it exception from unity iap, so i can't use Try/Catch block
In the last few days I've been having an issue upgrading and downgrading subscriptions on Google Play.
What I noticed is that when I do the following in the UpgradeDowngrade callback:
IGooglePlayStoreExtensions extensions = _storeExtensionProvider.GetExtension<IGooglePlayStoreExtensions>();
the variable extensions is of type UnityEngine.Purchasing.FakeGooglePlayStoreExtensions.
I'm assuming that this is the problem since it says fake.
Thank you in advance.
Are you running this on a device? The fake store would be expected in the Unity Editor play mode. And can you elaborate, last few days? It was working previously with no changes made since? Do you get an error?
I am running this on a device, I saw the class using adb logcat (see attached image).
Last time that I can be certain that it worked is since out last release on Google Play in February.
I don't get any errors.
I'm afraid that this might be a bug since Android released their subscription restore feature.
So no errors and the user is not seeing any issues and can upgrade and downgrade, so your only concern is the log entry? I suspect I am missing something
Haha, no, I already said I'm having issues upgrading/downgrading the subscription using Unity IAP.
When I call extensions.UpgradeDowngradeSubscription(oldSKU, newSKU); nothing happens, and I'm supposed to get the Google Play window.
I mentioned the name of the class because someone might have it as a lead to solve the problem.
So it was working correctly previously, and then your released app started to fail? And you didn't update the code?
What do you mean I didn't update the code? How am I supposed to update a one method call?
Not sure how is this important, but we just noticed that the update fails.. Looks like an issue with Unity IAP code itself, because the same code was working perfectly fine before.
Unity IAP is updated to 1.22.
I am asking you if you updated your app. Or did your app stop working on its own, without changing any code or submitting a new release ("didn't update the code"). This would imply a possible Google server side issue. You mentioned "worked perfectly fine before", before what? The Google update?
The code that handles Unity IAP was not updated at all. The implementation worked perfectly fine until we tested it a week ago, and the feature where you can update your subscription does not work any more on Android.
I updated Unity IAP to 1.22 and still the same issue persists. When I debugged the code it works well until I have to excute the following code to initiate the update:
IGooglePlayStoreExtensions extensions = _storeExtensionProvider.GetExtension<IGooglePlayStoreExtensions>();
@IvanTesseract So you are claiming that it worked at one point, but Google changed something at their end and it stopped working. I will test here also.
@JeffDUnity3D yes, it worked well at one point. Thank you very much for your quick replies and your patience.
@JeffDUnity3D Hi, I'm pretty confused as to how to use SubscriptionManager.UpdateSubscription...
I know how to call it based on previously posts in this thread but, even after spending many hours pouring through the IAPDemo example and documentation, I have no idea where/when to call it. Is it instead of InitiatePurchase? Before InitiatePurchase? After InitiatePurchase? In OnPurchaseComplete?
IAPButton only has Events for OnPurchaseComplete and OnPurchaseFailure... Why not also have an Event for something like OnPurchaseBegin (assuming SubscriptionManager.UpdateSubscription would be called before InitiatePurchase to either fire before the purchase is completed or instead of InitiatePurchase).
My apologies, I'm so confused by this that I don't really know how to word my questions very precisely...
Why is there no example of SubscriptionManager.UpdateSubscription usage in the IAPDemo.cs script?
Speaking of that script, I assumed I could call SubscriptionManager.UpdateSubscription in my own PurchaseButtonClick method similar to how IAPDemo works, but that can't be right because that fires on my on UI button as opposed to the default app store UI buttons. In other words, my own UI buttons shouldn't initialize (and therefore complete) the purchase because the app store buttons do that. (Or am I misunderstanding something?) So I'm really confused as to why the IAPDemo script show a custom PurchaseButtonClick method initialing the purchase...
Anyway, any help/guidance you could provide on when/where to successfully call SubscriptionManager.UpdateSubscription would be really helpful, thanks!
(btw, I'm using Unity IAP v1.22.0)
You call it when the user wants to update their subscription. You call it by itself. This may help https://forum.unity.com/threads/google-play-subscription-upgrade-downgrade.528434/ You would want to use IAP Scripting and not Codeless
@JeffDUnity3D Thanks for the quick reply, but please provide more details if possible (like I mentioned, I've thoroughly looked through this thread and am still confused)...
So are you saying that I don't use IAPButtons? If not I assume I manually call this in my own ClickPurchaseButton method:
And if so, when updating a subscription, do I call SubscriptionManager.UpdateSubscription instead of, before, or after that InititiatePurchase method?
Already mentioned, you just call it by itself. It has no relation to InitiatePurchase. You call it after IAP initialization. The link I provided has the exact code.
Why is there no example in IAPDemo?
The feature is new. IAPDemo is already def'd bloated.
OK, I got it all figured out I think. Everything made a lot more sense once I used IAPListener on my purchase button(s) instead of IAPButton (i.e. "IAP Scripting and not Codeless") and called SubscriptionManager.UpdateSubscription instead of m_Controller.InitiatePurchase(m_Controller.products.WithID(productID), "developerPayload"); when updating subscriptions.
Hi. How can I change the replaceSkusProrationMode to upgrading/downgrading the subscription?
Are you getting an error with SubscriptionManager.UpdateSubscription?
No, upgrading/downgrading works good. But I need to change the "proration mode". Default value does not suit me. Can I change it to IMMEDIATE_WITH_TIME_PRORATION or IMMEDIATE_AND_CHARGE_PRORATED_PRICE, as described here https://developer.android.com/google/play/billing/billing_subscriptions#Allow-upgrade?
Understood, I will check with the team here.
Hello, what about my question?
No updates yet. If we decide to address this, any update would come in the next release, no ETA at this time.
I'm really lost with regards to up/downgrading subscriptions. Testing out on Android, nothing happens after calling
SubscriptionManager.UpdateSubscription(...) except for it immediately making the callback.
I want to make it possible for the user to toggle between monthly and annual subscriptions. If the monthly is currently subscribed, the annual presents itself as an option and vice versa. I succesfully test-purchased both monthly and annual subs individually but now fail to toggle between these using the SubscriptionManager.UpdateSubscription method. I have also without success tried various alternatives:
This is my code:
public void BuyAnnualSubscription()
Debug.Log("Monthly already purchased, so upgrading to Annually");
SubscriptionManager.UpdateSubscription(m_Controller.products.WithID(kProductNameSubscriptionAnnually), m_Controller.products.WithID(kProductNameSubscriptionMonthly), "accountId", OnSubUpgradedApple, OnSubUpgradedGoogle);
private void OnSubUpgradedGoogle(string arg1, string arg2)
Debug.Log("arg1: " + arg1 + " arg2: " + arg2);
productSubAnnually.Purchased = true;
productSubMonthly.Purchased = false;
m_PurchaseInProgress = false;
The OnSubUpgradedGoogle is triggered immediately and but nothing happens on screen (should see a Google Play purchase confirmation dialogue I believe). In my log I have:
Spoiler: Output of log
Initializing UnityPurchasing via Codeless IAP
UnityIAP Version: 1.22.0
Using configuration builder objects
--- [Pressing Monthly Subscription button]
No other subscription, so purchasing Monthly
Purchasing product asychronously: 'x.x.x.sub.monthly'
Purchase OK: x.x.x.sub.monthly
\\\\\\\"accountId\\\\\\\":\\\\\\\"fake account id\\\\\\\"}\\\",
Receipt is valid. Contents:
ProcessPurchase: PASS. Product: 'x.x.x.sub.monthly'
--- [Pressing Annual Subscription button]
Monthly already purchased, so upgrading to Annually
Unity IAP 1.22.0
Unity IAP Package 2.0.6
Android 9.0, Pixel 2 XL rooted
I have the same problem as the IvanTesseract
One period upgrade method worked normally, but now when I call it google play panel doesnt show up. I see that app is paused and the music stops. Only thing I can do is press back on mobile phone to return to app.
Cant say I changed something that would stop that method cause buying subcription works normaly. But when I call update subcription it looks like something happens, but nothing shows from google.
IvanTesseract have you had any luck in solving this problem?
This was a tough nut to crack before I solved it. So get this, if you change CurrentCulture on current thread it wont show google upgrade subscription panel. I changed it to my culture because of sorting an array of names which have different symbols then English alphabet. So if you have this problem as I did than change CurrentCulture to default one:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
This one's driving me crazy... I'm attempting both UpgradeDowngradeSubscription and UpdateSubscription for Google Subscriptions.
When I call UpdateSubscription I receive the message, "The product has not been purchased, a subscription can only be upgrade/downgrade when has already been purchased". Calling UpgradeDowngradeSubscription leaves me with a frozen app - very similar to skrpeta. Unfortunately his fix did not work for me, which leaves me wondering if there's anything else I can do.
I'm trying to make sure this works in a test environment before publishing. The app is on a closed track, and I am purchasing with the test billing. I cannot assume this works without verifying.
Do I have to pass in the product with its receipt when calling UpdateSubscription? If so, that's not going to be possible in every case. I'm only saving the receipt server-side, not the entire product data with it. The receipt field is read-only, so I cannot update a "fake" product including the receipt.
Not sure what else I can do, but any advice would be appreciated! Documentation is next-to-none, and this thread is the only other lifeline I have come across.
IvanTesseract JeffDUnity3D any chance for clarification?
EDIT: It appears to be working all of a sudden.. I changed the developerPayload to an empty string. I can confirm it is now working using the SubscriptionManager.UpdateSubscription(newProduct, oldProduct, "", AppleStoreCallback, googlePlayCallback);.
here is the update info and i cann't find the method to get the subscriptions upgrade process in the "Added "
Unity IAP 1.20.1 is now available
1.20.1: Replaces IAP 1.21 as stable release for non-UDP IAP developers. Those requiring UDP support should remain on 1.21.
Developers currently using Unity IAP 1.21 that do not need support for the Unity Distribution Platform (UDP) Beta on Android should transition to this release.
Added a callback function that allows developers to check the state of the upgrade/downgrade process of subscriptions on GooglePlay.
I am checking, and will follow up here.
So, I also got this issue, but for a far stupider reason. I just had the new product and the old product around the wrong way in UpdateSubscription(). I figured I'd post this here anyway in case someone was searching for potential answers, since this is the ONLY place on Google that this error message appears. I can't guarantee that will be your issue however.