Quick Integration

This document illustrates the now.gg Payments Quick Integration flow to enable in-app purchases within your game on Unity.

Tip

  • The Quick Integration flow is simple and fast with minimum code-level changes. However, for more controlled integration, please refer to the Standard Integration flow.
  • Choose your Unity IAP version:
    • Unity IAP v4.x: Follow the Unity IAP v4 section (StandardPurchasingModule).
    • Unity IAP v5.x: Follow the Unity IAP v5 section (StoreController). Unity IAP v5.x is supported with nowSDK v4.4+.

Here is a comparison between the Standard and Quick integrations:

Particulars Quick Integration Standard Integration
Integration Flows You should use the Quick Integration flow if your IAP implementation is based on Unity IAP v4.x.x or v5.x.x You should use the Standard Integration flow for all other payment integration requirements.
Consumable and Subscription Products Quick Integration flow only supports one-time consumable products. Standard Integration flow supports both consumable and subscription products.

Download and Import the Module

The now.gg Payments Unity module is included as a Unity package file NowGGUnitySdk.unitypackage.

Add the module to your Unity project:

  1. Download the package containing the latest version of now.gg Payments module for Unity.
  2. Now, import the package into your Unity project. To do this:
    • Click on Assets > Import Package > Custom Package.
      • Select NowGGUnitySdk.unitypackage from your system.
    • By default, all the modules are pre-selected. Deselect any modules you do not require, and click on Import, as shown below:
  3. Add Required Dependencies
    • Click on Assets > External Dependency Manager > Android Resolver > Resolve
      This operation will download and add all the required dependencies to the Assets/Plugins/Android directory of your project using the Unity External Dependency Manager.

Implement now.gg Payments

Once the now.gg Payments module has been imported, and the dependencies have been added; you can follow this section to implement now.gg Payments with your app/game.

Unity IAP v4.x

The following steps are required to configure now.gg Purchasing module with your app.

  • Replace the Standard Purchasing Module StandardPurchasingModule.Instance() used in Unity IAP with now.gg Purchasing Module NowGG.Sdk.NowGGPurchasingModule.Instance().
  • Pass the app’s PaymentId to now.gg Payments module while initializing payments.
  • Ensure you have added the desired in-app products within nowStudio, which are configured with your Unity Purchasing module.
    • These in-app products will be displayed for the user to buy.
    • For now, now.gg IAP supports only consumable products.

The following sample illustrates these configurations:

public void Start()
{
    /* Current code
    var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    */

    // Replace with
    var builder = ConfigurationBuilder.Instance(NowGG.Sdk.NowGGPurchasingModule.Instance());

    NowGG.Sdk.NowGGPaymentsSdkManager.Instance.PaymentId = "<your_Payment_ID_here>";
}

Important Information

  • An initial check is performed to ensure you are initializing the now.gg Payments service on the now.gg Platform.
    • If now.gg IAP is unavailable, the Unity’s StandardPurchasingModule instance will be returned by default in case now.gg Payment isn’t supported.
  • PaymentId is a unique identifier for your app and can be found in nowStudio under App Details. More information.

Reference



Unity IAP v5.x

The following steps are required to configure now.gg Payments with Unity IAP v5:

  1. Initialize the now.gg Store Controller using NowGGStoreController.Init() and pass your app’s PaymentId.
  2. Subscribe to store callbacks (recommended before making store calls).
  3. Establish a connection to the store using await m_StoreController.Connect().
  4. Fetch the required products using m_StoreController.FetchProducts(...).
    • After products are fetched, fetch existing purchases using m_StoreController.FetchPurchases().

The following sample illustrates these configurations:

 StoreController m_StoreController; 
 
  async void InitializeIAP() 
  { 

      /* Current code
      m_StoreController = UnityIAPServices.StoreController(); 
      */
     
      // Replace with
      m_StoreController = NowGGStoreController.Init(<"your_PaymentID_here">);

      m_StoreController.OnPurchasePending += OnPurchasePending; 

      await m_StoreController.Connect(); 


      m_StoreController.OnProductsFetched += OnProductsFetched;
      m_StoreController.OnPurchasesFetched += OnPurchasesFetched; 

      var initialProductsToFetch = new List<ProductDefinition> 
      { 
         new(goldProductId, ProductType.Consumable), 
         new(diamondProductId, ProductType.Consumable) 
      }; 
    
      m_StoreController.FetchProducts(initialProductsToFetch); 
  }

Important Information

  • Detailed implementation of Unity IAP can be found here.
  • PaymentId is a unique identifier for your app and can be found in nowStudio under App Details. More information.
  • Ensure the product IDs configured in nowStudio match the product IDs used in your Unity implementation.
    • For now, now.gg IAP supports only consumable products.

Reference

×
Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg