Unity IAP Store Guides - Amazon, Apple, Google Play, Windows

Ok, :slight_smile:

1 Like

After implement IAP Unity, I can’t build my project anymore. Seem to be IAP Unity not working with Google Plugins (Admob and GooglePlayService)

This is my origin post about this bug

I have integrated Unity IAP into our game and during testing for Windows Store I’ve experienced the following:

  • x86: everything works well
  • x64: I get an exception during UnityPurchasing.Initialize() (System.AggregateException in mscorlib.ni.dll; the exception’s message is simply “One or more errors occurred.”)

I’ve been trying to wrap my head around it for some time already and have googled a lot but haven’t found anyone with the same problem. I’ve just read the document attached to the first post of this topic and found this:

So what I would like to know is this: does the mock billing system for Windows Store work only for x86 architecture? Or it is supposed to work on x64 and it means that I’m doing something wrong.

@rizzin Yeah I’m having the same problem. It seems to only work currently with x86.
If I try x64 I receive the following error on my project when running in Visual Studio

I only changed it to x86 after I noticed that line in the guide as well.

@skullthug I’ve been getting pretty much the same error. Glad to see it’s not only me.

Alright, until someone of the devs sheds some light on this issue, I’ll consider the IAP working alright as long as it works just on x86 platform.

In retrospect I’m guessing IL2CPP is required for 64bit? And that (see above) is still in the works.

Well, i have setup all correctly following the information:

i got it working under google and apple store, but cant get it on windows phone.
I have tested with :
varbuilder=ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

builder.Configure().useMockBillingSystem=true;

This last line is for testing purposes really?
But when i press button for purchase anything dont work…
Visualdebug:
UnibillWin8:Exception loading listing information:Exception from HRESULT: 0x805A01F7
(Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 40)
BuyProductID FAIL. Not initialized.
(Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 40)

You should set this flag for the purchasing module, like this:

var module = StandardPurchasingModule.Instance();
module.useMockBillingSystem = true;
var builder = ConfigurationBuilder.Instance(module);
builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = true;
1 Like

Thank you very much.
Now it works like a charm!
And, when we send the final app to market, we have to remove module.usemockbillingsystem = true; really?

Yeah, as far as I understand, you have to remove it both from module and from builder.
I’ve separated this stuff into a separate variable in order to prevent situations where I change this flag in module and forget to do so in builder or vice versa. Like so:

public class MyClass : IStoreListener
{
  private bool useMockBillingSystem = true;
  void Initialize()
  {
    var module = StandardPurchasingModule.Instance();
    module.useMockBillingSystem = useMockBillingSystem;
    var builder = ConfigurationBuilder.Instance(module);
    builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = useMockBillingSystem;
    //other stuff
  }
}
1 Like

Then, this is the final method to send the final app, ok.
Only you use the bool to check on editor or testing really?
Thank you for all
Regards.

I set it to true for testing in Visual Studio and on a Windows Phone device too.
When preparing to release the game I will set it to false.

1 Like
private bool useMockBillingSystem = false;

        public void InitializePurchasing()
        {
            // If we have already connected to Purchasing ...
            if (IsInitialized())
            {

                return;
            }

            var module = StandardPurchasingModule.Instance();
            module.useMockBillingSystem = useMockBillingSystem;
            var builder = ConfigurationBuilder.Instance(module);
            builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = useMockBillingSystem;

            builder.AddProduct("B2D2", ProductType.NonConsumable, new IDs
                {
                    {"b2d2", GooglePlay.Name},
                    {"b2d2", WindowsPhone8.Name},
                    {"b2d2", AppleAppStore.Name}
                });
UnityPurchasing.Initialize(this, builder);
}

This is my configuration, but is not working.

Should i use WinRt .name instead of WindowsPhone8.name ?
Also with a blanck space between winrt and .name?

I get this debugging on visual:
The thread 0x690 has exited with code 0 (0x0).
UnibillWin8:Exception loading listing information:Exception from HRESULT: 0x805A0194
BuyProductID FAIL. Not initialized.

I think you should use “WinRT.name” instead of “WindowsPhone8.name”. At least I’m sure this is the case if you are targeting windows universal platform.

1 Like

I only got published at windows phone market. But also with alot of graphics issue on some device.

If your product id is “b2d2” across all platforms then you can simply give it a name of “b2d2”, you don’t need to redeclare it for every single platform - only those where it is different.

You are not using the mock billing system, are you testing as a beta test distribution? Before your app is published you can only test IAP via installing the app as a beta.

1 Like

I only need to do this?

 builder.AddProduct("B2D2", ProductType.NonConsumable, new IDs {"b2d2"  });

Or what should be the correct syntax?
And, for testing purposes i can get the windows of fake purchases on testing, but for final release, what should be the method:

 var module = StandardPurchasingModule.Instance();
         
            var builder = ConfigurationBuilder.Instance(module);

This alone?

Hi @IndieFist ,

I believe it should be,

builder.AddProduct(“b2d2”, ProductType.NonConsumable);

I have also changed B2D2 to lower case since some platforms’ product ids are case sensitive.

Yes, you should not need to specify anything else for production Windows IAP.

Well, with this code my inAPP on windows still not working.
I have missed something?
Its required to do something on visual studio?

1 Like

Well, i got this published on my game and people are asking on game review why they can´t buy new characters!
Arggggg need to fix that!!