Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved iAP Subscription issue

Discussion in 'Unity IAP' started by nelfstor, Aug 25, 2022.

Thread Status:
Not open for further replies.
  1. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello, I've met some problems with implementing subscription in unity (google) shop.

    When there is just subscription added and no ordinary products (consumable or non-consumable) - it doesn't initialize ( StoreController). Coming up with an error:
    " OnInitializeFailed NoProductsAvailable".

    If I add one non-consumable product it initializes and works successfully, ( StoreController initializes also). And clicking the buy button openes the google shop dialogue where i can buy this item as a tester.

    I add subscription the same way as I do with the ordinary products:
    builder.AddProduct(subscriptionProductId, ProductType.Subscription);

    I copy ProductID directly from code to the console.

    In Google Console I added subscription in the corresponding section. It show "active" just near the item.

    What else i can check?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Thank you for your response.

    I attach both logs. With only subscription added it fires OnInitializeFailed. If I add one non-consumable product - It initializes the shop (but still doesn't buy the subscription).

    Am i right, that products being added via configuration builder are compared with products in google play console? And if it can not find corresponding products - it fires "OnInitializeFailed"?

    It looks like something is wrong with subscription. Though there are not much to do with it in google. Product ID is
    "com.digitalempire.koalasrevenge.sub". And it shows "Active" near subscription in Google console. Are there any other setting that can affect the process?
     

    Attached Files:

  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The first logs say Unavailable Product com.digitalempire.koalasrevenge.sub but I don't see any products in the second log. Are you testing via Closed testing on Google, and have created a (second) Google account and added them as a tester? For IAP, you need to accept the tester invite and download the app from Google Play the first time. Subsequently you can side-load directly via USB. And yes, if IAP can't find any available products or there is a productID misspelling, it will not initialize. You might want to compare to the Sample IAP Project here and publish it as a second test project https://forum.unity.com/threads/sample-iap-project.529555/#post-7922275 and https://docs.unity3d.com/Packages/com.unity.purchasing@4.4/manual/UnityIAPGoogleConfiguration.html
     
  5. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    I use internal testing. ( Consumable and non-consumable products work fine. - Are subscriptions blocked in internal testing? )

    Yes, I use second google account, it is in the testers. I used the link to "accept the invitation in testing".
    With ordinary products (again) it works fine - google identificate him as a tester with tester card. And I can buy it.

    I passed through sample project, and even made another project with working shop based on it. That's why I don't think issue is there ( if subscriptions managed as ordinary products). I can share my code.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do not use internal testing, use Closed testing. Remove your internal test. No need to share your code which you claim is not working. Instead, you would want to review the Sample code which is known to work.
     
  7. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    I'll do that. Please tell me: why I shouldn't use internal testing. It works fine with ordinary products.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You would need to ask Google. I suspect for security reasons.
     
  9. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello, Jeff!

    Finally Google reviewed app for closed testing. In this version I added one non-consumable product and subscription.

    It fails to buy subscription giving this error in Android logcat:

    2022.09.13 12:20:43.282 20801 23437 Error Unity NullReferenceException: Object reference not set to an instance of an object.
    2022.09.13 12:20:43.282 20801 23437 Error Unity at Unity.Services.Analytics.TransactionCurrencyConverter.Convert (System.String currencyCode, System.Double value) [0x00000] in <00000000000000000000000000000000>:0
    2022.09.13 12:20:43.282 20801 23437 Error Unity at UnityEngine.Purchasing.AnalyticsAdapter.GenerateRealCurrencySpentOnPurchase (UnityEngine.Purchasing.Product product) [0x00000] in <00000000000000000000000000000000>:0
    2022.09.13 12:20:43.282 20801 23437 Error Unity at UnityEngine.Purchasing.AnalyticsAdapter.BuildTransactionFailedParameters (UnityEngine.Purchasing.Product product, UnityEngine.Purchasing.PurchaseFailureReason reason) [0x00000] in <00000000000000000000000000000000>:0
    2022.09.13 12:20:43.282 20801 23437 Error Unity at UnityEngine.Purchasing.AnalyticsAdapter.SendTransactionFailedEvent (UnityEngine.Purchasing.Product product, UnityEngine.Purchasing.PurchaseFailureReason reason) [0x00000] in <00000000000000000000000000000000>:0
    2022.09.13 12:20:43.282 20801 23437 Error Unity at UnityEngine.Purchasing.AnalyticsClient.OnPurchaseFailed (UnityEngine.Purchasing.Product product, UnityEngine.Purchasing.PurchaseFailureReason reason) [0x00000]

    I attach complete log. I added string to check every object not to be null.

    Consumable products works fine.

    For subscription settings I left just one country with price in USD. Looks like Unity tries to convert USD to local currency and fails.

    What will be your advice?
     

    Attached Files:

    Last edited: Sep 13, 2022
  10. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @nelfstor

    Thanks for the logs. It looks like there's a nullpointer in your product metadata, either in its isoCurrencyCode or its localized price. Since this is a public interface, you can probably debug the object within your product. Do you display these in your UI?

    Normally these fields are populated when your product is fetched from the GooglePlay store, which happens on initialization. Are you adding these products after initializing your UnityPurchasing object? Or are they perhaps not defined in your local catalog definitions?

    You can try calling FetchAdditionalProducts with any missing definitions added after you initialize IAP.

    Can you please explain what you mean by this? Is the subscription your only product that is configured like this?
     
  11. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello, John!

    Thanks for your response!

    Do you mean to debug log product metadata after UnityPurchasing.Initialize?

    I add products via ConfigurationBuilder.Instance and then initialize Unity Purchasing.
    Actually my code is just code of example (attached to Unity in-app-purchasing) with some customization.

    What is local catalog definition? - I use scripting, not iAP button. Should I add something to subscription besides product ID?

    I'll read about it, thanks for the link.

    First I checked all countries so the prices were in local currencies. As far as error reported some problems with converter - I made a new subscription with just one country checked and price is in USD. But the error is still the same.
     
  12. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @nelfstor ,

    Yes I did mean debug log product metadata after UnityPurchasing.Initialize, or after FetchAdditionalProducts (whichever gets your subscription).

    So, if I understand correctly, you have the problem with subscriptions regardless if you only set one country's currency or many?

    Also, yes it's fine if you only use scripting for your catalog information. You are not obliged to use the Catalog Editor. As for the product id alone being sufficient, there are several versions of
    ConfigurationBuilder.AddProduct
    . If you need special overrided store IDs for Google, Apple, etc, or are leveraging our Payout system, then use another version of the function, as needed. It's up to your needs. See our API here: https://docs.unity3d.com/Packages/c...tyEngine.Purchasing.ConfigurationBuilder.html

    In the meantime I will go take a look at the Analytics package code and see if there is a bug in their currency converter, and if so, report it.
     
  13. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello @John_Corbett!

    I did logging in OnInitialized method through all items. First item is consumable - and metadata is Ok. Second item is - subscription and metadata is wrong (and also on 2022.09.14 18:26:07.825 it marked as an unavailable product).
    While logging subscription - it falls from "try" to "catch" on this line: item.metadata.GetGoogleProductMetadata().introductoryPrice

    For now i don't understand - what can be the reason of such behaviour. Is it some Google restrictions which make product unavailable? Or is it code issue?

    This time I used internal testing to speed up the things, but i had same errors in closed testing. ( It took over a week to pass the closed testing for this tiny game). Nevertheless I plan to release it there anyway.

    Yes, it happens in any case.

    2022.09.14 18:26:07.631 3799 5509 Warn Unity <color=white><size=14> 09.14 18:26:07 #MyLog UGS initialized; </size></color>
    2022.09.14 18:26:07.631 3799 5509 Warn Unity Global:MyLog(String)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity <UGS_InitializationAsync>d__9:MoveNext()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Runtime.CompilerServices.MoveNextRunner:Run()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.Task:FinishContinuations()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.Task`1:TrySetResult(TResult)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(TResult)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity Unity.Services.Core.<InitializeAsync>d__11:MoveNext()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Runtime.CompilerServices.MoveNextRunner:Run()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.Task:FinishContinuations()
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Threading.Tasks.Task`1:TrySetResult(TResult)
    2022.09.14 18:26:07.631 3799 5509 Warn Unity System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResu
    2022.09.14 18:26:07.688 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog Purchasing initialized </color></size>
    2022.09.14 18:26:07.688 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity <UGS_InitializationAsync>d__9:MoveNext()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Runtime.CompilerServices.MoveNextRunner:Run()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.Task:FinishContinuations()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.Task`1:TrySetResult(TResult)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(TResult)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity Unity.Services.Core.<InitializeAsync>d__11:MoveNext()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Runtime.CompilerServices.MoveNextRunner:Run()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.Task:FinishContinuations()
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Threading.Tasks.Task`1:TrySetResult(TResult)
    2022.09.14 18:26:07.688 3799 5509 Warn Unity System.Runtime.CompilerServices.AsyncTaskMethodBuilder
    2022.09.14 18:26:07.825 3799 5509 Warn Unity Unavailable product com.companyname.gamename.sub3-com.companyname.gamename.sub3
    2022.09.14 18:26:07.825 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:HasAvailableProductsToPurchase(Boolean)
    2022.09.14 18:26:07.825 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.825 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.825 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.825 3799 5509 Warn Unity
    2022.09.14 18:26:07.826 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog StoreController Initialized </color></size>
    2022.09.14 18:26:07.826 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.826 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.826 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.826 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.826 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.826 3799 5509 Warn Unity
    2022.09.14 18:26:07.827 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog item 0: UnityEngine.Purchasing.Product </color></size>
    2022.09.14 18:26:07.827 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.827 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.827 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.827 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.827 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.827 3799 5509 Warn Unity
    2022.09.14 18:26:07.829 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata price: 1 || definition com.companyname.gamename.test || available to purchase: True || type: NonConsumable </color></size>
    2022.09.14 18:26:07.829 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.829 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.829 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.829 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.829 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.829 3799 5509 Warn Unity
    2022.09.14 18:26:07.830 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata: UnityEngine.Purchasing.GoogleProductMetadata </color></size>
    2022.09.14 18:26:07.830 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.830 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.830 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.830 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.830 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.830 3799 5509 Warn Unity
    2022.09.14 18:26:07.832 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata isoCurrencyCode USD </color></size>
    2022.09.14 18:26:07.832 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.832 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.832 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.832 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.832 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.832 3799 5509 Warn Unity
    2022.09.14 18:26:07.833 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata price string: 1,00 $ </color></size>
    2022.09.14 18:26:07.833 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.833 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.833 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.833 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.833 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.833 3799 5509 Warn Unity
    2022.09.14 18:26:07.834 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog google metadata: </color></size>
    2022.09.14 18:26:07.834 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.834 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.834 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.834 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.834 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.834 3799 5509 Warn Unity
    2022.09.14 18:26:07.835 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog item 1: UnityEngine.Purchasing.Product </color></size>
    2022.09.14 18:26:07.835 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.835 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.835 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.835 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.835 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.835 3799 5509 Warn Unity
    2022.09.14 18:26:07.836 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata price: 0 || definition com.companyname.gamename.sub3 || available to purchase: False || type: Subscription </color></size>
    2022.09.14 18:26:07.836 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.836 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.836 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.836 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.836 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.836 3799 5509 Warn Unity
    2022.09.14 18:26:07.838 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata: UnityEngine.Purchasing.ProductMetadata </color></size>
    2022.09.14 18:26:07.838 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.838 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.838 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.838 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.838 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.838 3799 5509 Warn Unity
    2022.09.14 18:26:07.839 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata isoCurrencyCode </color></size>
    2022.09.14 18:26:07.839 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.839 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.839 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.839 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.839 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.839 3799 5509 Warn Unity
    2022.09.14 18:26:07.840 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog metadata price string: </color></size>
    2022.09.14 18:26:07.840 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.840 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.840 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.840 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.840 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2022.09.14 18:26:07.840 3799 5509 Warn Unity
    2022.09.14 18:26:07.844 3799 5509 Warn Unity <size=14><color=lime> 09.14 18:26:07 #MyLog catch </color></size>
    2022.09.14 18:26:07.844 3799 5509 Warn Unity Global:MyGreenLog(String)
    2022.09.14 18:26:07.844 3799 5509 Warn Unity Shop:UnityEngine.Purchasing.IStoreListener.OnInitialized(IStoreController, IExtensionProvider)
    2022.09.14 18:26:07.844 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2022.09.14 18:26:07.844 3799 5509 Warn Unity UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2022.09.14 18:26:07.844 3799 5509 Warn Unity UnityEngine.Purchasing.Extension.UnityUtil:Update()
     
  14. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @nelfstor ,

    As to why your product is unavailable, or you not getting the metadata, either it's a new product that hasn't been pushed to your app yet (This could take a few days to become available if you just added it and published your app), or there is an mismatch between the store specific ID for the product on Google Play with that of your ProductID. Is this only happening on Google and is working on iOS or some other store?

    You can try using the AddProduct where you can pass Store-Specific IDs for each store and make sure it matches GooglePlay's. Also note these IDs are case-sensitive. Check your Google Play Store dashboard for your app to be sure you're using the exact same string with no typos.
     
  15. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello @John_Corbett!

    I've made a new app, took unity samples which comes with the in-app purchases. I added 2 consumable products in google console and they were available in 5 minutes.

    I use copy+paste for this, but of course, i checked it for 10 times, and i've been doublechecked by collegues.

    It only happens with google shop, for now it is the only shop we use.

    I used both: codeless and scriptable way, adding subscription in builder or fetch it OnInitialized. Every time consumable products give me test window to buy it, while subscription can not be found.

    Do you have code examples for this?
     
  16. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @nelfstor,

    If I recall correctly Apple takes longer to approve subscriptions, specifically. This is because they are the ones managing renewal and expiry, but we recall Google being much faster and being available sooner, so I doubt it is this because it's been some time already.

    Either way it's very odd...

    I see in your logs that you have a price of zero
    #MyLog metadata price: 0 || definition com.companyname.gamename.sub3 || available to purchase: False || type: Subscription </color></size>
    . It could be that Google will not honor a price of zero if this is what you set, or perhaps they send 0 if it's unavailable.

    Possible issues:
    • Do you have the subscription deactivated on your google dashboard?
    • Is it available in "All Regions"?
    • Are you in the region with a valid price set that matches the currency useable in that region?
    • Is your region's price set to 0 USD?

    As for adding Store Specific IDs (although at this point I am convince this isn't your problem, but posting anyway):

    Here's a code sample:

    Code (CSharp):
    1.  var ids = new IDs();
    2. ids.Add("com.unity.iap.test.triple.damage.google",  new string[] { GooglePlay.Name });
    3. builder.AddProduct("com.unity.iap.test.triple.damage", ProductType.Subscription, ids);
    Here's the codeless way via the catalog editor:

    upload_2022-9-16_14-15-52.png
     
  17. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
    Hello, @John_Corbett!

    Thanks for your response!

    I set a price of 1 USD, because zero is likely to be wrong value for the price. So it is what happens when i try to get metadata from the subscription product ( unavailable at all or being initialized with error).

    yes

    Most likely "yes". It should be 1 USD. It is totally ok with the consumable purchases - i can buy them for 1 USD.

    Subsriptions are "activated" in their preferences. Are there any place in Google Console when all them can be deactivated??

    Thank you for code example. I try it tomorrow or on monday.
     
  18. nelfstor

    nelfstor

    Joined:
    Jun 6, 2022
    Posts:
    12
  19. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @nelfstor ,

    A bugfix for that TransactionFailed event NullReferenceException is going to be released with IAP 4.5.1 soon. I don't have a release date yet, but keep an eye on the forums for an announcement.

    As to why your subscription isn't enabled, I am still unsure, as your problem seems unique and I don't have enough information. Do you see your subscription as Active in the list?

    upload_2022-10-21_15-0-10.png

    Maybe you need to contact Google?
     
  20. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    178
    Release IAP 4.5.1 is out, you can find the details here.

    This thread is now closed. Feel free to reach out via a new thread if you encounter further issues.
    Thanks!
     
Thread Status:
Not open for further replies.