Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved Error: Required to have a value for transactionName

Discussion in 'Unity IAP' started by alecfilios, Jun 28, 2022.

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

    alecfilios

    Joined:
    May 21, 2019
    Posts:
    8
    After I updated my Unity In-App Purchases package to 4.2.1 I keep getting this error whenever I make a purchase in the editor using the Fake store UI. I'm afraid it will follow my actual purchases as well. Any suggestions?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please share the code you are using, the exact error text and steps to reproduce, we will take a look. What version did you update from? I just tested with the Sample IAP Project v3 here with IAP 4.2.1 and was able to make a successful purchase in the Editor and on an Android device. https://forum.unity.com/threads/sample-iap-project.529555/#post-7922275
     
  3. Alegev

    Alegev

    Joined:
    Feb 14, 2017
    Posts:
    9
    the same error in editor, I just update my unity to 2020.3.37f1, and iap package to 4.2.1, and I finally found this is not a bug.

    the stacktrace in editor is :
    Required to have a value for transactionName
    UnityEngine.Debug:LogError (object)
    Unity.Services.Analytics.AnalyticsServiceInstance:Transaction (Unity.Services.Analytics.TransactionParameters) (at Library/PackageCache/com.unity.services.analytics@4.0.1/Runtime/Events/Transaction/AnalyticsServiceInstance.Transaction.cs:19)
    UnityEngine.Purchasing.PurchasingManager:InitiatePurchase (UnityEngine.Purchasing.Product)​

    I just called "m_StoreController.InitiatePurchase(product)" as the same as the demo.

    After check the internal code, it is because the new version of iap package will require the product "title" in the IAP Catalog config, where I left it null, then it will show the error log.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    IAP Catalog? Are you using Codeless?
     
  5. alecfilios

    alecfilios

    Joined:
    May 21, 2019
    Posts:
    8
    You are going to suggest not using codeless. I've seen your answer in almost all the posts that mention codeless. Until Unity removes codeless or makes it deprecated please put this suggestion as a comment.

    We are using a reliable way of implementing IAP with plenty of resources online. If you want to answer with "don't use Codeless" then describe the detailed process of the solution without it, not just say it.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, that is correct. You would want to use my alternative suggestion
     
  7. alecfilios

    alecfilios

    Joined:
    May 21, 2019
    Posts:
    8
    For you it's not an alternative, it's mandatory. You cannot expect people to go back on changing their whole implementation a week before release.
     
  8. MattWhiting

    MattWhiting

    Joined:
    Jan 11, 2016
    Posts:
    79
    I got the same error about transactionName.
    I started over following Jeff's sample code, and the error went away.
    I'm not sure what changed, but my GUESS is that I had not filled in anything in the "Title" slot of the "IAP Catalog" dialog in the Unity Editor. When I re-did it all, I went ahead and copied both "Title" and "Description" from what I had in the Google Play Store.

    So maybe try that I guess.
     
    ExcaliburGames likes this.
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you want IAP to work without refunding purchases after 3 days, it's mandatory. You might want to test prior to a week before release in the future. Typically you don't release if your game isn't working.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    As mentioned, do not use Codeless. It's only still in place for users who may have been using it in a previous version and need to upgrade without compiler errors so they can then switch to Scripted IAP. We are working on a major update which will replace Codeless.
     
  11. TheEugeneL

    TheEugeneL

    Joined:
    Dec 7, 2017
    Posts:
    41
    I don't understand. I released the game using Codeless. Everything worked. You still have this method listed in your documentation.
    https://docs.unity3d.com/Packages/com.unity.purchasing@4.4/manual/Overview.html

    Today I needed to add a new purchase urgently and I get a similar error.

    In this post you say that Codeless can no longer be used. But why you don't mention it anywhere? There is no news?
     
  12. -chris

    -chris

    Joined:
    Mar 1, 2012
    Posts:
    99
    @JeffDUnity3D

    Strongly believe this "Required to have a value for transactionName" error is happening in 4.4.1 when calling:

    As far as I can tell, I merely use the ConfigurationBuilder to pass in an id and type. There's no "transaction name" I've ever had to deal with...?

    This is all via scripting. I do not use the Codeless thing.

    Error happens on native iOS builds.
    Calling IAppleExtensions.RestoreTransactions seems to trigger the error easily.

    Unable to reproduce in the Editor (2021.3.9f1).

    Although this is getting thrown as an "error", it doesn't seem to affect any functionality negatively. Purchases and restores still work. Feels like it's an async error somewhere behind the scenes.

    Stack trace:
    Code (csharp):
    1. Unity.Services.Analytics.AnalyticsServiceInstance:Transaction(TransactionParameters)
    2. UnityEngine.Purchasing.AnalyticsAdapter:SendTransactionEvent(Product)
    3. UnityEngine.Purchasing.AnalyticsClient:OnPurchaseSucceeded(Product)
    4. UnityEngine.Purchasing.StoreListenerProxy:processPurchase(PurchaseEventArgs)
    5. UnityEngine.Purchasing.PurchasingManager:processPurchaseIfNew(Product)
    6. UnityEngine.Purchasing.Extension.UnityUtil:Update()
     
  13. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    That is correct, sorry about that. We need to update the documentation. But let's try to get you working regardless. Did you enter the Title as mentioned earlier? Also, ensure to check the "Consume Product" checkbox in the IAP Catalog, even for non-consumables and subscriptions.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You may be right, I will test. Can you share your purchasing code where you call RestoreTransactions, are you using the basic Sample IAP Project code?
     
  15. -chris

    -chris

    Joined:
    Mar 1, 2012
    Posts:
    99
    Not using the sample code.

    As a rough glimpse:
    Code (csharp):
    1. IExtensionProvider unityStoreExtensionProvider; // gets assigned via IStoreListener.OnInitialized
    2.  
    3. ...
    4.  
    5. var apple = unityStoreExtensionProvider.GetExtension<IAppleExtensions>();
    6. apple.RestoreTransactions((restorationFinishedWithoutError) => {
    7.     if (restorationFinishedWithoutError) {
    8.         // Restoration successful, though potentially nothing was actually restored
    9.     }
    10.     else {
    11.         // Error restoring
    12.     }
    13. });
    14.  
    restorationFinishedWithoutError ends up being true, despite the error being thrown.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it! So it appears that it is an error with Analytics and sending the transaction event to our back end. The restore(s) themselves should complete as expected. Can you confirm that the restore process actually works? I suspect it does, but you would likely not see this transaction as a purchase in the Unity Dashboard. If so, then not a real showstopper but definitely something we would need to fix.
     
  17. -chris

    -chris

    Joined:
    Mar 1, 2012
    Posts:
    99
    Sounds plausible.

    Yes, the restore process works. From a fresh App Store sandbox account, did a new purchase (which triggered the error somewhere I believe), uninstalled the iOS app, reinstalled, did a restore (again triggering the error), and the restore worked.

    I haven't looked at the Unity Dashboard with all this, but the transactions get retrieved successfully within the code despite the error.
     
  18. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I will test. Can you confirm if you are initializing UGS Analytics? That is how I will be testing. https://docs.unity.com/analytics/AnalyticsSDKGuide.html
     
  19. -chris

    -chris

    Joined:
    Mar 1, 2012
    Posts:
    99
    Thanks for testing.

    I don't use the Analytics at all.

    I initialize with Unity Gaming Services, but just for the store:
    Code (csharp):
    1. try {
    2.     var options = new InitializationOptions().SetEnvironmentName("production");
    3.     await UnityServices.InitializeAsync(options);
    4. }
    5. catch (System.Exception e) {
    6.     // An error occurred during services initialization.
    7.     Debug.LogWarning($"WARNING: UnityGamingServices.Start: Failed to initialize. Exception: {e}");
    8. }
     
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    So you are calling UnityServices.InitializeAsync()? I'm not sure if it is related to the error, but is how I will start testing.
     
    -chris likes this.
  21. MrBear666

    MrBear666

    Joined:
    Dec 6, 2021
    Posts:
    73
    So what to do for fixing that? I have this error to
     
  22. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are still looking into this. But for now, you should be able to safely ignore the error.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'm not seeing the error in my testing in the XCode logs when testing locally. I initialize UGS Analytics and call RestoreTransaction and all works as expected, and nothing in the XCode logs. I'm using IAP 4.4.1 and Analytics 4.1.0 and the Sample IAP Project. I do believe that users are seeing the error, but we need to reproduce here also. It may have been fixed in Analytics 4.1.0
     
  24. grraff1230

    grraff1230

    Joined:
    Mar 7, 2021
    Posts:
    1
    The same problem
     
  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide steps to reproduce, thanks.
     
  26. vuqarahim

    vuqarahim

    Joined:
    Dec 4, 2020
    Posts:
    4
    So can we safely ignore the error and publish without a problem or should we try to implement the sample IAP?
     
  27. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    Hello,
    This error is caused by localizedTitle in the ProductMetadata being empty.
    If you are getting this error, make sure the titles of your products are specified in the store.
     
  28. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    167
    This thread is now closed. Feel free to reach out via a new thread if you encounter further issue.
    Thanks!
     
Thread Status:
Not open for further replies.