UWP + Il2CPP + .Net 4.6 + IAP 1.19 Failed to initialize

Hi guys,

I’m trying to get IAP working for Windows Store but failing miserably so far. The project compiles fine and I can run the game but IAP initialization doesn’t seem to finish (the complete callback is not being called). After calling UnityPurchasing.Initialize(), the only thing that I can see in the logs are:

UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 0, productsOnly = False
UnityIAPWin8:Building full product list with existing purchases
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 10000, productsOnly = False
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 20000, productsOnly = False

The PollForProducts() call seems to be looped forever.

The app passed certification on Windows Store and I have 1 test IAPproduct published and cleared for sale.

Is there any bug in the 1.19? I’m trying with 1.20 now, see what happens.

Hey @pasq_1 ,
Have you figure out the solution.
I have met the similar question when I try to initialize the IAP. I build with the same backend il2cpp + .NET4.6 + IAP 1.19. And cannot get callbacks from initialized success or failure

info: (0x80070525) [WinStoreAuth::AuthenticationInternal::CreateGoldenAccountTokenRequest]
\winstoreauth.cpp(1588)\Windows.ApplicationModel.Store.dll!00007FFA69732122: (caller: 00007FFA6972B876) ReturnHr(14) tid(34f0) 80070525 The specified account does not exist.
[WinStoreAuth::AuthenticationInternal::CreateGoldenAccountTokenRequest]
info: (0x80070525) [WinStoreAuth::AuthenticationInternal::CaptureGoldenAccountTicket]
\winstoreauth.cpp(2090)\Windows.ApplicationModel.Store.dll!00007FFA69732142: (caller: 00007FFA6972B876) ReturnHr(15) tid(34f0) 80070525 The specified account does not exist.
[WinStoreAuth::AuthenticationInternal::CaptureGoldenAccountTicket]
info: (0x80070525) [WinStoreAuth::AuthenticationInternal::GetStorePrimaryAccountTicketForUri]
\winstoreauth.cpp(305)\Windows.ApplicationModel.Store.dll!00007FFA6972B8B7: (caller: 00007FFA6972B569) ReturnHr(16) tid(34f0) 80070525 The specified account does not exist.
[WinStoreAuth::AuthenticationInternal::GetStorePrimaryAccountTicketForUri]
ERROR:ChkHr(AuthenticationInternal::GetStorePrimaryAccountTicket( 0, AuthenticationEndpoint::OneStore, PromptType::Silent, false, nullptr, authTicket.GetAddressOf(), providerType, spWebTokenRequestResult.GetAddressOf())) (0x80070525) [CollectionsServiceProxyV6::GetUnfulfilledConsumables]
ERROR:ChkHr(CollectionsServiceProxyV6::GetUnfulfilledConsumables(bigCatId, pCV, items)) (0x80070525) [Windows::ApplicationModel::Store::GetUnfulfilledConsumablesOperationServer::GetUnfulfilledConsumablesSync]
ERROR:ChkHr(GetUnfulfilledConsumablesSync( _spStoreCommerceServer->GetAppCatalogId(cv.Get()), cv.Get(), _spStoreCommerceServer->GetProductIdCache(), _spUnfulfilledList.Get())) (0x80070525) [Windows::ApplicationModel::Store::GetUnfulfilledConsumablesOperationServer::smile:oWork]

@yibojiang_tt Are you able to test with 1.20? Could you share your purchase script?

@JeffDUnity3D , I was using 1.19, I haven’t tried 1.20 yet. I’ve tested with useMockBillingSystem = true everything works fine. But after I publish the app and in app addons. The initialize doesn’t have any callbacks.

Here’s my script for iap initialize.

        var products = new List<CrossPlatformProduct>
        {
            new CrossPlatformProduct(
                type:UnityEngine.Purchasing.ProductType.Consumable,
                referenceName:"ten",
                androidId:"apples_10",
                amazonId:"apples_10",
                windowsId:"apples_10"
            ),
            new CrossPlatformProduct(
                type:UnityEngine.Purchasing.ProductType.Consumable,
                referenceName:"twenty",
                androidId:"apples_20",
                amazonId:"apples_20",
                windowsId:"apples_20"
            ),
            new CrossPlatformProduct(
                type:UnityEngine.Purchasing.ProductType.Consumable,
                referenceName:"thirty",
                androidId: "apples_30",
                amazonId:"apples_30",
                windowsId:"apples_30"
            ),
            new CrossPlatformProduct(
                type: UnityEngine.Purchasing.ProductType.Subscription,
                referenceName: "subscription",
                androidId: "foo.sub1",
                amazonId: "foo.subscriptions",
                windowsId: "foo.subscriptions"
            )
            #if UNITY_IOS
            , new CrossPlatformProduct(
                type:UnityEngine.Purchasing.ProductType.NonConsumable),
                referenceName: "pack",
                androidId: null,
                iosId:"stuffpack",
            #endif
        };
            var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance ());


            foreach (var xProd in products)
            {
                builder.AddProduct(xProd.ReferenceName, xProd.ProductType, new IDs
                {
                    { xProd.IosId, AppleAppStore.Name },
                    { xProd.AndroidId, GooglePlay.Name },
                    { xProd.AmazonId, AmazonApps.Name },
                    { xProd.WindowsId, WindowsStore.Name }
                });
            }

            UnityPurchasing.Initialize (this, builder);

Does the app initialize on the other stores, such as Google Play?

yes, other platform works fine. That only happens on UWP when publish to Store. I followed the docs here Unity - Manual: Configuring for Windows Store

Got it, I will check with the IAP team. FYI, any fixes will go into the next release which is some time out, likely near the end of August or more.

Are there any solutions? Or do I need to wait for the next IAP update for the fixes?

I haven’t tested yet, but from the description, it seems like a fix might be necessary.

Just to confirm - 1.20 doesn’t work either. Does it mean we need to wait until the end of August?

We have not started work on this issue at this time. It remains to be seen if it will be included in the next release. Due to resource constraints, we are focusing on iOS and Android issues. It is on my task list to test.

@yibojiang_tt Your error message is different than the behavior described in the initial post. Your error is “The specified account does not exist”. Can you confirm that you have created a developer account on the Windows Dashboard, perhaps share a screenshot? Also, you said “The initialize doesn’t have any callbacks.” You should have coded an OnInitializedFailed and OnInitialized callback, perhaps you meant the initialize isn’t calling your existing callbacks, can you confirm?

@JeffDUnity3D , yes, I can confirm that. I already setup the store app and the iaps.
My class is inherit IStoreListener. And the I have
void OnInitialized (IStoreController controller, IExtensionProvider extensions) and implemented the public void OnInitialized (IStoreController controller, IExtensionProvider extensions) void OnInitializeFailed (InitializationFailureReason reason) in my purchase class.
As I mentioned early on, everything works fine in local test mode. The issue happens when I publish to the store to test real purchase.

Thank you @yibojiang_tt we are investigating.

I can also confirm that everything is set up properly:

  • app is added, certified and published
  • IAPs are added, certified and published
  • initialization has defined callbacks OnInitialized and OnInitializeFailed
  • the same code works fine on Android and iOS for many months now

However, contrary to @yibojiang_tt , I can’t even test IAPs locally. Same result, no callback, no products retrieved from the store.

@pasq_1 , have you set useMockBillingSystem = true. before the initialization code. I think for local IAP test you don’t need to publish to the store. The UnityIAP still not working in the real purchase. I ended up writing our own native in-app purchase plugin for windows store.

@yibojiang_tt , I haven’t checked the useMockBillingSystem flag and just gone your way, writing a native code. All works fine now.

@JeffDUnity3D , if you find the bug in UnityIAP and would like us to test the changes, feel free to ask.

@yibojiang_tt , @pasq_1

Thanks for reporting this issue. I have passed it along to the team and they are investigating it. Sorry we couldn’t get it resolved sooner. I’ll post here if we find any workarounds, etc that don’t require an updated plugin.

Hi, we have similar problem when trying to request products without login in Windows Store for UWP application build using IL2CPP. If user is logged in the WS there is no issue with loading products.

Log for Unity IAP v1.21.0:

ERROR:ChkHr(spStoreCommerce->Initialize(cv.GetHStringReference().Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
     :  IsActive: false, IsTrial: TRUE, App type: 3, Listner count: 0   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  ExpirationDateTime: 1601/1/1 00:00:00   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseManager: VALID   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseInstance: not set    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  UnfulfilledList: VALID  [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :    <empty list>    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkBool(instance != nullptr, ((HRESULT)0x803F6107L))  (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::InitializeIdsFromLicense]
ERROR:ChkHr(InitializeIdsFromLicense()) (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::Initialize]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5A4FCB50.
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5A4FDBA0.
The thread 0x6364 has exited with code 0 (0x0).
info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
     :License Info for app MyCompany.MyGame_5.7.0.0_x64__ewn699wwxwmvy: (CV = kn9eWDDdo0CS5ltv.105.2) [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkHr(spStoreCommerce->Initialize(cv.GetHStringReference().Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
     :  IsActive: false, IsTrial: TRUE, App type: 3, Listner count: 0   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  ExpirationDateTime: 1601/1/1 00:00:00   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseManager: VALID   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseInstance: not set    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  UnfulfilledList: VALID  [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :    <empty list>    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkBool(instance != nullptr, ((HRESULT)0x803F6107L))  (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::InitializeIdsFromLicense]
ERROR:ChkHr(InitializeIdsFromLicense()) (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::Initialize]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF572FC960.
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF572FD9B0.
info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
     :License Info for app MyCompany.MyGame_5.7.0.0_x64__ewn699wwxwmvy: (CV = kn9eWDDdo0CS5ltv.108.2) [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  IsActive: false, IsTrial: TRUE, App type: 3, Listner count: 0   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  ExpirationDateTime: 1601/1/1 00:00:00   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseManager: VALID   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseInstance: not set    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  UnfulfilledList: VALID  [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :    <empty list>    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkBool(instance != nullptr, ((HRESULT)0x803F6107L))  (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::InitializeIdsFromLicense]
ERROR:ChkHr(InitializeIdsFromLicense()) (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::Initialize]
ERROR:ChkHr(spStoreCommerce->Initialize(cv.GetHStringReference().Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5ABFC8C0.
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5ABFD910.
The thread 0xc94 has exited with code 0 (0x0).
The thread 0x5cd4 has exited with code 0 (0x0).
The thread 0x288c has exited with code 0 (0x0).
The thread 0x56ac has exited with code 0 (0x0).
The thread 0x1114 has exited with code 0 (0x0).
info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
     :License Info for app MyCompany.MyGame_5.7.0.0_x64__ewn699wwxwmvy: (CV = kn9eWDDdo0CS5ltv.111.2) [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  IsActive: false, IsTrial: TRUE, App type: 3, Listner count: 0   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  ExpirationDateTime: 1601/1/1 00:00:00   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseManager: VALID   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseInstance: not set    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  UnfulfilledList: VALID  [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :    <empty list>    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkBool(instance != nullptr, ((HRESULT)0x803F6107L))  (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::InitializeIdsFromLicense]
ERROR:ChkHr(InitializeIdsFromLicense()) (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::Initialize]
ERROR:ChkHr(spStoreCommerce->Initialize(cv.GetHStringReference().Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5A4FCB50.
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5A4FDBA0.
info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
     :License Info for app MyCompany.MyGame_5.7.0.0_x64__ewn699wwxwmvy: (CV = kn9eWDDdo0CS5ltv.114.2) [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkHr(spStoreCommerce->Initialize(cv.GetHStringReference().Get())) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::GetStoreCommerce]
     :  IsActive: false, IsTrial: TRUE, App type: 3, Listner count: 0   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  ExpirationDateTime: 1601/1/1 00:00:00   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseManager: VALID   [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  LicenseInstance: not set    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :  UnfulfilledList: VALID  [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
     :    <empty list>    [Windows::ApplicationModel::Store::LicenseInformationServer::smile:umpLicensesToDebugger]
ERROR:ChkBool(instance != nullptr, ((HRESULT)0x803F6107L))  (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::InitializeIdsFromLicense]
ERROR:ChkHr(InitializeIdsFromLicense()) (0x803f6107)    [Windows::ApplicationModel::Store::Internal::StoreCommerceServer::Initialize]
ERROR:ChkHr(GetStoreCommerce(&spStoreCommerce)) (0x803f6107)    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5AAFCE20.
Exception thrown at 0x00007FFC18E2A388 in MyGame.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x000000AF5AAFDE70.

I’m trying to bring our game to Windows UWP and I’m getting exactly the same issue with Unity IAP. Using Unity 2017.4.13 + IAP 1.17 + IL2CPP + .NET 4.6 API level.

When I’m signed in to the Microsoft Store, it all works fine and the logs look like this:

 info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 0, productsOnly = False
info:GetUnfulfilledConsumablesAsync() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::GetUnfulfilledConsumablesAsync]
UnityIAPWin8:Building full product list with existing purchases
info:GetAppReceiptAsync() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::GetAppReceiptAsync]
info:get_LicenseInformation() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::get_LicenseInformation]
Purchaser: Purchaser OnInitialized: SUCCESS

When I’m signed out from the store I’m seeing exceptions being thrown out and it looks like IAP is retrying and retrying in a loop, never finishing the initialization.

 info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
info:GetUnfulfilledConsumablesAsync() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::GetUnfulfilledConsumablesAsync]
Exception thrown at 0x00007FF92622A388 in Solitaire Dreams.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0000000C5F6FD4F0.
Exception thrown at 0x00007FF92622A388 in Solitaire Dreams.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0000000C5F6FBDF0.
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 0, productsOnly = False
UnityIAPWin8:Building full product list with existing purchases
info:LoadListingInformationAsync() invoked.    [Windows::ApplicationModel::Store::CurrentAppFactory::LoadListingInformationAsync]
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 10000, productsOnly = False
info:GetUnfulfilledConsumablesAsync() invoked. [Windows::ApplicationModel::Store::CurrentAppFactory::GetUnfulfilledConsumablesAsync]
Exception thrown at 0x00007FF92622A388 in Solitaire Dreams.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0000000C619FD550.
Exception thrown at 0x00007FF92622A388 in Solitaire Dreams.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0000000C619FBE50.
UnityIAPWin8:Building full product list with existing purchases

What’s interesting is that when I alt-tab without stopping the code and sign into the store then alt-tab back to the game, the loop will pick up and finish the initialization properly.
So it’s definitely dependent on whether I’m signed out.

Granted, some of those inapp products I’ve added just today and I’ve seen people here saying that it might take a day or two to become fully published. I’ll give it another try on Monday, hoping for the best.