Example #1
0
        //
        // --- 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;
        }
Example #2
0
	/// <summary>
	/// This will be called when Unity IAP has finished initialising.
	/// </summary>
	public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
	{
		m_Controller = controller;
		m_AppleExtensions = extensions.GetExtension<IAppleExtensions> ();
		m_SamsungExtensions = extensions.GetExtension<ISamsungAppsExtensions> ();
		m_MoolahExtensions = extensions.GetExtension<IMoolahExtension> ();

		InitUI(controller.products.all);

		// On Apple platforms we need to handle deferred purchases caused by Apple's Ask to Buy feature.
		// On non-Apple platforms this will have no effect; OnDeferred will never be called.
		m_AppleExtensions.RegisterPurchaseDeferredListener(OnDeferred);

		Debug.Log("Available items:");
		foreach (var item in controller.products.all)
		{
			if (item.availableToPurchase)
			{
				Debug.Log(string.Join(" - ",
					new[]
					{
						item.metadata.localizedTitle,
						item.metadata.localizedDescription,
						item.metadata.isoCurrencyCode,
						item.metadata.localizedPrice.ToString(),
						item.metadata.localizedPriceString,
						item.transactionID,
						item.receipt
					}));
			}
		}

		// Prepare model for purchasing
		if (m_Controller.products.all.Length > 0) 
		{
			m_SelectedItemIndex = 0;
		}

		// Populate the product menu now that we have Products
		for (int t = 0; t < m_Controller.products.all.Length; t++)
		{
			var item = m_Controller.products.all[t];
			var description = string.Format("{0} - {1}", item.metadata.localizedTitle, item.metadata.localizedPriceString);

			// NOTE: my options list is created in InitUI
			GetDropdown().options[t] = new Dropdown.OptionData(description);
		}

		// Ensure I render the selected list element
		GetDropdown().RefreshShownValue();

		// Now that I have real products, begin showing product purchase history
		UpdateHistoryUI();
	}
    private Selectable m_InteractableSelectable; // Optimization used for UI state management

    /// <summary>
    /// This will be called when Unity IAP has finished initialising.
    /// </summary>
    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        m_Controller = controller;
        m_AppleExtensions = extensions.GetExtension<IAppleExtensions> ();

		InitUI(controller.products.all);

        Debug.Log("Available items:");
        foreach (var item in controller.products.all)
        {
            if (item.availableToPurchase)
            {
                Debug.Log(string.Join(" - ",
                    new[]
                    {
                        item.metadata.localizedTitle,
                        item.metadata.localizedDescription,
                        item.metadata.isoCurrencyCode,
                        item.metadata.localizedPrice.ToString(),
                        item.metadata.localizedPriceString
                    }));
            }
        }

        // Prepare model for purchasing
        if (m_Controller.products.all.Length > 0) 
        {
            m_SelectedItemIndex = 0;
        }

        // Populate the product menu now that we have Products
        for (int t = 0; t < m_Controller.products.all.Length; t++)
        {
            var item = m_Controller.products.all[t];
            var description = string.Format("{0} - {1}", item.metadata.localizedTitle, item.metadata.localizedPriceString);

            // NOTE: my options list is created in InitUI
            GetDropdown().options[t] = new Dropdown.OptionData(description);
        }

        // Ensure I render the selected list element
        GetDropdown().RefreshShownValue();

        // Now that I have real products, begin showing product purchase history
        UpdateHistoryUI();
    }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     IAPManager.controller = controller;
     IAPManager.extensions = extensions;
     OnInit?.Invoke();
 }
Example #5
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("OnInitialized: PASS");
     m_StoreController        = controller;
     m_StoreExtensionProvider = extensions;
 }
Example #6
0
    /// <summary>
    /// This will be called when Unity IAP has finished initialising.
    /// </summary>
    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        m_Controller                   = controller;
        m_AppleExtensions              = extensions.GetExtension <IAppleExtensions>();
        m_SamsungExtensions            = extensions.GetExtension <ISamsungAppsExtensions>();
        m_MoolahExtensions             = extensions.GetExtension <IMoolahExtension>();
        m_MicrosoftExtensions          = extensions.GetExtension <IMicrosoftExtensions>();
        m_UnityChannelExtensions       = extensions.GetExtension <IUnityChannelExtensions>();
        m_TransactionHistoryExtensions = extensions.GetExtension <ITransactionHistoryExtensions>();
#if SUBSCRIPTION_MANAGER
        m_GooglePlayStoreExtensions = extensions.GetExtension <IGooglePlayStoreExtensions>();
#endif

        InitUI(controller.products.all);

        // On Apple platforms we need to handle deferred purchases caused by Apple's Ask to Buy feature.
        // On non-Apple platforms this will have no effect; OnDeferred will never be called.
        m_AppleExtensions.RegisterPurchaseDeferredListener(OnDeferred);

#if SUBSCRIPTION_MANAGER
        Dictionary <string, string> introductory_info_dict = m_AppleExtensions.GetIntroductoryPriceDictionary();
#endif
        // This extension function returns a dictionary of the products' skuDetails from GooglePlay Store
        // Key is product Id (Sku), value is the skuDetails json string
        //Dictionary<string, string> google_play_store_product_SKUDetails_json = m_GooglePlayStoreExtensions.GetProductJSONDictionary();

        Debug.Log("Available items:");
        foreach (var item in controller.products.all)
        {
            if (item.availableToPurchase)
            {
                Debug.Log(string.Join(" - ",
                                      new[]
                {
                    item.metadata.localizedTitle,
                    item.metadata.localizedDescription,
                    item.metadata.isoCurrencyCode,
                    item.metadata.localizedPrice.ToString(),
                    item.metadata.localizedPriceString,
                    item.transactionID,
                    item.receipt
                }));
#if INTERCEPT_PROMOTIONAL_PURCHASES
                // Set all these products to be visible in the user's App Store according to Apple's Promotional IAP feature
                // https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/PromotingIn-AppPurchases/PromotingIn-AppPurchases.html
                m_AppleExtensions.SetStorePromotionVisibility(item, AppleStorePromotionVisibility.Show);
#endif

#if SUBSCRIPTION_MANAGER
                // this is the usage of SubscriptionManager class
                if (item.receipt != null)
                {
                    if (item.definition.type == ProductType.Subscription)
                    {
                        if (checkIfProductIsAvailableForSubscriptionManager(item.receipt))
                        {
                            string intro_json        = (introductory_info_dict == null || !introductory_info_dict.ContainsKey(item.definition.storeSpecificId)) ? null : introductory_info_dict[item.definition.storeSpecificId];
                            SubscriptionManager p    = new SubscriptionManager(item, intro_json);
                            SubscriptionInfo    info = p.getSubscriptionInfo();
                            Debug.Log("product id is: " + info.getProductId());
                            Debug.Log("purchase date is: " + info.getPurchaseDate());
                            Debug.Log("subscription next billing date is: " + info.getExpireDate());
                            Debug.Log("is subscribed? " + info.isSubscribed().ToString());
                            Debug.Log("is expired? " + info.isExpired().ToString());
                            Debug.Log("is cancelled? " + info.isCancelled());
                            Debug.Log("product is in free trial peroid? " + info.isFreeTrial());
                            Debug.Log("product is auto renewing? " + info.isAutoRenewing());
                            Debug.Log("subscription remaining valid time until next billing date is: " + info.getRemainingTime());
                            Debug.Log("is this product in introductory price period? " + info.isIntroductoryPricePeriod());
                            Debug.Log("the product introductory localized price is: " + info.getIntroductoryPrice());
                            Debug.Log("the product introductory price period is: " + info.getIntroductoryPricePeriod());
                            Debug.Log("the number of product introductory price period cycles is: " + info.getIntroductoryPricePeriodCycles());
                        }
                        else
                        {
                            Debug.Log("This product is not available for SubscriptionManager class, only products that are purchase by 1.19+ SDK can use this class.");
                        }
                    }
                    else
                    {
                        Debug.Log("the product is not a subscription product");
                    }
                }
                else
                {
                    Debug.Log("the product should have a valid receipt");
                }
#endif
            }
        }

        // Populate the product menu now that we have Products
        AddProductUIs(m_Controller.products.all);

        LogProductDefinitions();
    }
Example #7
0
    /// <summary>

    /// Called when Unity IAP is ready to make purchases.

    /// </summary>

    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)

    {
        this.controller = controller;
    }
Example #8
0
    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        m_StoreController = controller;
        // Store specific subsystem, for accessing device-specific store features.
        m_StoreExtensionProvider = extensions;

        init = true;
    }
 /// <summary>Register the price and currency that a user is using to make iOS in-app purchases.</summary>
 /// <remarks>
 /// After receiving the list of in-app purchases from Apple, this method can be called to record the localized item information.
 /// This overload is meant to be called from Unity's IStoreListener.OnInitialized callback passing in the first (controller) parameter.
 /// </remarks>
 /// <param name="unityStoreController">The IStoreController provided by Unity's IStoreListener.OnInitialized callback.</param>
 public static void RegisterIOSInAppPurchaseList(IStoreController unityStoreController)
 {
     if(unityStoreController != null)
         RegisterIOSInAppPurchaseList(unityStoreController.products);
 }
Example #10
0
 public void OnInitialized(IStoreController sc, IExtensionProvider ep)
 {
     storeController   = sc;
     extensionProvider = ep;
 }
 public StoreControllerSpecification()
 {
     target = new StoreControllerForTests();
 }
Example #12
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     this.controller = controller;
     this.extensions = extensions;
     Debug.Log("IAP初始化成功");
 }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("OnInitialized: PASS");
     m_StoreController = controller;
     m_StoreExtensionProvider = extensions;
 }
Example #14
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("On Initialized");
 }
Example #15
0
        //
        // --- IStoreListener
        //


        public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
        {
            // Purchasing has succeeded initializing. Collect our Purchasing references.
            Debug.Log("[IAPManager] OnInitialized.");

            // Overall Purchasing system, configured with products for this application.
            _StoreController = controller;
            // Store specific subsystem, for accessing device-specific store features.
            _StoreExtensionProvider = extensions;

            _AppleExtensions   = extensions.GetExtension <IAppleExtensions>();
            _SamsungExtensions = extensions.GetExtension <ISamsungAppsExtensions>();
            _MoolahExtensions  = extensions.GetExtension <IMoolahExtension>();

            // On Apple platforms we need to handle deferred purchases caused by Apple's Ask to Buy feature.
            // On non-Apple platforms this will have no effect; OnDeferred will never be called.
#if UNITY_IOS
            _AppleExtensions.RegisterPurchaseDeferredListener(OnDeferred);
#endif
#if UNITY_ANDROID
            _GooglePlayStoreExtensions = extensions.GetExtension <IGooglePlayStoreExtensions>();
#endif

#if RECEIPT_VALIDATION
    #if UNITY_EDITOR
    #else
        #if UNITY_IOS
            Dictionary <string, string> introductory_info_dict = _AppleExtensions.GetIntroductoryPriceDictionary();
        #endif
        #if UNITY_ANDROID
            Dictionary <string, string> introductory_info_dict = _GooglePlayStoreExtensions.GetProductJSONDictionary();
        #endif
    #endif
#endif
            // Store products
            for (int i = 0; i < controller.products.all.Length; i++)
            {
                Product    pp = controller.products.all[i];
                IAPProduct p  = null;
                if (products.ContainsKey(pp.definition.id))
                {
                    p                     = products[pp.definition.id];
                    p.priceString         = pp.metadata.localizedPriceString;
                    p.price               = pp.metadata.localizedPrice;
                    p.title               = pp.metadata.localizedTitle;
                    p.description         = pp.metadata.localizedDescription;
                    p.isoCurrencyCode     = pp.metadata.isoCurrencyCode;
                    p.hasReceipt          = pp.hasReceipt;
                    p.availableToPurchase = pp.availableToPurchase;
                    p.receipt             = pp.receipt;
                    p.transactionID       = pp.transactionID;
                    p.rawProduct          = pp;
                    p.hasReceipt          = pp.hasReceipt;

#if RECEIPT_VALIDATION
#if UNITY_EDITOR
#else
                    _UpdateReceipt(pp, ref p, introductory_info_dict);
#endif
#endif
                }
            }
            // callback
            if (OnIAPInitialized != null)
            {
                OnIAPInitialized(products);
            }
        }
 void IStoreListener.OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     _storeController        = controller;
     _storeExtensionProvider = extensions;
     OnInitialized?.Invoke(null, EventArgs.Empty);
 }
Example #17
0
  //  
  // --- IStoreListener
  //

  public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
    // Purchasing has succeeded initializing. Collect our Purchasing references.
    Debug.Log("OnInitialized: PASS");
    // Update m_products_map that would be used by UICharacters
    m_products_map = new Dictionary<string, Product>();
    foreach (Product product in controller.products.all) {
      m_products_map.Add(product.definition.id, product);
    }

    // Overall Purchasing system, configured with products for this application.
    m_StoreController = controller;
    // Store specific subsystem, for accessing device-specific store features.
    m_StoreExtensionProvider = extensions;
  }
Example #18
0
 // Checks to see if the app can connect to Unity IAP
 // Will continue trying in the background until successfully connected
 public void OnInitialized(IStoreController _Controller, IExtensionProvider _Extensions)
 {
     print("OnInitialized: Pass");
     ms_StoreController        = _Controller;
     ms_StoreExtensionProvider = _Extensions;
 }
    public void OnInitialized(IStoreController sc, IExtensionProvider ep)
    {
        Debug.Log("OnInitialized : PASS");

        storeController = sc;
        extensionProvider = ep;
    }
Example #20
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("OnInitialized: " + controller + ", " + extensions);
     this.controller = controller;
 }
Example #21
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     this.controller = controller;
     this.extensions = extensions;
 }
Example #22
0
        //
        // --- IStoreListener
        //

        public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
        {
            STORE_CONTROLLER   = controller;
            STORE_EXT_PROVIDER = extensions;
        }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("UnityIAP.OnInitialized Success");
     this.controller = controller;
 }
Example #24
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extension)
 {
     Debug.Log(message: "유니티 IAP초기화 성공");
     storeController        = controller;
     storeExtensionProvider = extension;
 }
Example #25
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     storeController        = controller;
     storeExtensionProvider = extensions;
 }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debug.Log("In-App Purchasing successfully initialized");
     m_StoreController = controller;
 }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     m_Controller      = controller;
     InternetAvailable = true;//初始化成功
     Debug.Log("IAP初始化成功");
 }
Example #28
0
 /// <summary>
 /// Called when Unity IAP is ready to make purchases.
 /// </summary>
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Debuger.Log("OnInitialized Succeed.");
     this.controller = controller;
 }
 public void OnInitialized(IStoreController controller)
 {
     this.m_ForwardTo.OnInitialized(controller, this.m_Extensions);
 }
Example #30
0
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     Log.WriteLog("OnInitialized: PASS.", Log.LevelsOfLogs.INFO, "PurchaseManager");
     m_StoreController        = controller;
     m_StoreExtensionProvider = extensions;
 }
Example #31
0
    public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    {
        m_StoreController = controller;

        m_StoreExtensionProvider = extensions;
    }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     _controller        = controller;
     _extensionProvider = extensions;
     _isInitialized     = true;
 }
Example #33
0
            void IStoreListener.OnInitialized(IStoreController controller, IExtensionProvider provider)
            {
                var eventArgs = new InitializedEventArgs(controller, provider);

                Initialized(this, eventArgs);
            }
Example #34
0
 public InitializedEventArgs(IStoreController controller, IExtensionProvider provider)
 {
     ExtensionProvider = provider;
     StoreController   = controller;
 }
Example #35
0
        // Optionally: verify old purchases online.
        // Once we've received the product list, we overwrite
        // the existing shop item values with this online data
        public void OnInitialized(IStoreController ctrl, IExtensionProvider ext)
        {
            controller = ctrl;
            extensions = ext;

            if (validator && validator.shouldValidate(VerificationType.onStart))
                validator.Validate();

            if (ShopManager.GetInstance())
                ShopManager.OverwriteWithFetch(controller.products.all);
        }
Example #36
0
    public void OnInitializeFailed(InitializationFailureReason error)
    {
   
        m_StoreController = null;
        // Store specific subsystem, for accessing device-specific store features.
        m_StoreExtensionProvider = null;

        init = false;
    }
 public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
 {
     //Debug.Log("IAPMgr initialized");
     mStoreController = controller;
     mStoreExtensionProvider = extensions;
 }
Example #38
0
 public void AddController(string key, IStoreController controller)
 {
     this.controllers[key] = controller;
 }