iOS - Unity Purchasing - OnInitialize Failed - NoProductsAvailable

**Note: I’ll update thread with solution if I find one before any replies. **

*Update: I have a feeling the issue is due to the fact that my “Paid Applications” Contract is still in a state of “In progress” Pending Tax and Bank info I will contact Apple to confirm this interrupts testing iAP’s.

Hi, I’m experiencing an issue, as described in the title, where in-app purchasing is failing to initialize. Reason stated: “OnInitializeFailed InitializationFailureReason: NoProductsAvailable” . I’m wondering what I’m missing?

Here’s the checklist of what I’ve done:
-created the app in iTunes Connect (with in-app purchasing enabled in the iOS App ID in Apple Developer site)
-specified the bundle ID in Unity to the same as the bundle ID for the app.
-iTunes Connect: added in-app purchase in features>In-App Purchases. (Status of the In-App purchase is listed as "Ready to Submit)
-iTunes Connect: added In-App purchase to iTunes Connect> iOS App > 1.0 Prepare for Submission > “In-App Purchases” section.
-iTunes Connect> iOS App > 1.0 Prepare for Submission > “Build” section - added current build.
-set the kProductIDNonConsumable = the ProductID as-spelled in the In-App purchase ProductID field. Also, set the kProductNameAppleNonConsumable = the ProductID as-spelled in the In-App purchase ProductID field.
-build the project, deploy to my non-Jailbroken iPad, Archive, validate archive, upload archive, delete existing version from iPad, and install the app uploaded build via TestFlight.
-Before running the app, I log-out of itunes store in ipad settings.

Here is the portion of the script pertaining to purchasing initialization, derived from the Unity example project for the iAP system:

public class Purchaser : MonoBehaviour, IStoreListener
{
    public UnityEngine.UI.Text txtOutput;

    private static IStoreController m_StoreController;          // The Unity Purchasing system.
    private static IExtensionProvider m_StoreExtensionProvider; // The store-specific Purchasing subsystems.

    // Product identifiers for all products capable of being purchased:
    // "convenience" general identifiers for use with Purchasing, and their store-specific identifier
    // counterparts for use with and outside of Unity Purchasing. Define store-specific identifiers
    // also on each platform's publisher dashboard (iTunes Connect, Google Play Developer Console, etc.)

    // General product identifiers for the consumable, non-consumable, and subscription products.
    // Use these handles in the code to reference which product to purchase. Also use these values
    // when defining the Product Identifiers on the store. Except, for illustration purposes, the
    // kProductIDSubscription - it has custom Apple and Google identifiers. We declare their store-
    // specific mapping to Unity Purchasing's AddProduct, below.
    public static string kProductIDConsumable =    "consumable";
    public static string kProductIDNonConsumable = "ProductIDasListedInITunesConnect";
    public static string kProductIDSubscription =  "subscription";

    // Apple App Store-specific product identifier for the non-consumable producK -BES
    private static string kProductNameAppleNonConsumable = "ProductIDasListedInITunesConnect";
  
    void Awake()
    {
        // If we haven't set up the Unity Purchasing reference
        if (m_StoreController == null)
        {
            // Begin to configure our connection to Purchasing
           InitializePurchasing();
        }
    }


    public void InitializePurchasing()
    {
        // If we have already connected to Purchasing ...
        if (IsInitialized())
        {
            // ... we are done here.
            return;
        }
    
        // Create a builder, first passing in a suite of Unity provided stores.
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    
        // Add a product to sell / restore by way of its identifier, associating the general identifier
        // with its store-specific identifiers.
          
        // adding the non-consumable product.
           builder.AddProduct(kProductIDNonConsumable, ProductType.NonConsumable, new IDs(){
            { kProductNameAppleNonConsumable, AppleAppStore.Name },
        });
    
        // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration
        // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed.
        UnityPurchasing.Initialize(this, builder);
    }


    private bool IsInitialized()
    {
        // Only say we are initialized if both the Purchasing references are set.
        return m_StoreController != null && m_StoreExtensionProvider != null;
    }
     

    //
    // --- IStoreListener
    //

    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        // Purchasing has succeeded initializing. Collect our Purchasing references.
        Debug.Log("OnInitialized: PASS");
    
        // Overall Purchasing system, configured with products for this application.
        m_StoreController = controller;
        // Store specific subsystem, for accessing device-specific store features.
        m_StoreExtensionProvider = extensions;
    }


    public void OnInitializeFailed(InitializationFailureReason error)
    {
        // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
        //bes: Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
        txtOutput.text = "OnInitializeFailed InitializationFailureReason:" + error;
    }

}

Any ideas on what I’m doing wrong?

2 Likes

Hey @Frank-Grimes ,
I have run into this issue for the reason you stated at the top of your post in the update. Once I had all of my tax information and agreements in order, the IAPs started to show up. Please let us know if you run into further issues.
Cheers,
Chris

2 Likes

Will do Chris. I’m holding-off on in-app testing until I create a new Apple dev account for my LLC.

UPDATE: Resolved: I was able to test via iOS device successfully: The issue was that I didn’t complete filling out the banking and tax forms under the “Paid Applications Agreement” in the iTunes Connect “Tax and Banking” section.

I spun my wheels in lieu of filling out the forms completely :frowning: :frowning:

I hope this helps others who are checking-off the items in their checklist during troubleshooting.

7 Likes

Thank U Very Much!!!

Fingers crossed this was my issue as well :slight_smile: thanks for this post!