[Solved] Codeless IAP: Questions regarding initialization and simulator

Dear all,
I am using codeless IAP for WP8.1.
Currentily I have some issues and I want to clarify some questions:

Description of my issue
IAP will be made in the settings menu. The menu UI is inactive at game start and will be activated as users clicks on settings. Then IAP will initialize, because the IAP button gameobject is active. Also for testing, I added a script to the button for IAP (“IAP Simulator”).

  • Is this a problem if a user clicks on settings and then immediatly on IAP button to purchase? I am not sure IAP is already initialized at this time. Is there a way to do this at game start (with the IAP button script)?
  • When do I have to run the Simulator script? Are there dependencies? Do I need to move this into the IAP button script?
  • In editor it works like expected. If run the build on phone (“Master”), I get the following log:

UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 0, productsOnly = False
after some time
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 10000, productsOnly = False
UnityIAPWin8:Begin PollForProducts() persistent = True, delay = 20000, productsOnly = False

As said, I currently want to use the simulator - not publishing the game to the store. I would expect that the simulator script would avoid to poll products from the store (instead simulate).

Components

Unity Version: 5.5.2f1
Unity IAP version: 1.11.1
Platforms target: Windows Store / Phone 8.1

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Purchasing;

//Unity IAP features support for Microsoft’s In App Purchase simulator, which allows you to test IAP purchase flows on devices before publishing your application.
//Possible TODO: Make sure you disable the mock billing system before publishing your application!!!!
public class IAPSimulator : MonoBehaviour
{
    // Use this for initialization
    void Start ()
    {
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
        builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = true;
    }
}

Greetings
Pat

Nobody any idea?

We do encourage developers to initialize Purchasing as soon as possible after the app has started. This will allow things like promo codes for various stores to work correctly.

One possible solution would be to load the store menu offscreen rather than have it inactive. We are working on improvements to better handle this situation.

You will need to add this code to the IAPButton.cs file. You can add it to the IAPButtonStoreManager class. With that in place, you won’t need to configure your products in the Windows Store.

Alternatively, you can use the FakeStore that is now included in the IAP plugin as of version 1.10.0. It does a similar thing as the MockBilling in that it allows you to test your fulfillment / UI before creating your products.

// Enable the FakeStore for all IAP activity
var module = StandardPurchasingModule.Instance();
module.useFakeStoreAlways = true;
1 Like