Error: Required to have a value for transactionName

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?

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://discussions.unity.com/t/700293/4

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.

IAP Catalog? Are you using Codeless?

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.

Yes, that is correct. You would want to use my alternative suggestion

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.

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.

1 Like

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.

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.

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?

@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:

Unity.Services.Analytics.AnalyticsServiceInstance:Transaction(TransactionParameters)
UnityEngine.Purchasing.AnalyticsAdapter:SendTransactionEvent(Product)
UnityEngine.Purchasing.AnalyticsClient:OnPurchaseSucceeded(Product)
UnityEngine.Purchasing.StoreListenerProxy:processPurchase(PurchaseEventArgs)
UnityEngine.Purchasing.PurchasingManager:processPurchaseIfNew(Product)
UnityEngine.Purchasing.Extension.UnityUtil:Update()

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.

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?

Not using the sample code.

As a rough glimpse:

IExtensionProvider unityStoreExtensionProvider; // gets assigned via IStoreListener.OnInitialized

...

var apple = unityStoreExtensionProvider.GetExtension<IAppleExtensions>();
apple.RestoreTransactions((restorationFinishedWithoutError) => {
    if (restorationFinishedWithoutError) {
        // Restoration successful, though potentially nothing was actually restored
    }
    else {
        // Error restoring
    }
});

restorationFinishedWithoutError ends up being true, despite the error being thrown.

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.

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.

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

Thanks for testing.

I don’t use the Analytics at all.

I initialize with Unity Gaming Services, but just for the store:

try {
    var options = new InitializationOptions().SetEnvironmentName("production");
    await UnityServices.InitializeAsync(options);
}
catch (System.Exception e) {
    // An error occurred during services initialization.
    Debug.LogWarning($"WARNING: UnityGamingServices.Start: Failed to initialize. Exception: {e}");
}

So you are calling UnityServices.InitializeAsync()? I’m not sure if it is related to the error, but is how I will start testing.

1 Like