NowGGPaymentsSdkManager

This document contains the reference for NowGGPaymentsSdkManagerclass and its methods.

Property:
Instance – Returns the instance of the class.

Public Methods

The following public method references are provided:

  1. InitializeIap()
  2. OnInitSuccess()
  3. OnInitFailed()
  4. PurchaseProduct()
  5. OnPurchaseFailed()
  6. ConfirmPendingPurchase()

1. InitializeIap

This method is used to Initialize the now.gg Payments module with provided arguments.

Usage

 NowGGPaymentsSdkManager.Instance.InitializeIap(PAYMENT_ID, IN_GAME_ID)

Parameters

Type Param Description
string PAYMENT_ID App-specific ID to enable now.gg Payments
string IN_GAME_ID Unique identifier for your user.

2. OnInitSuccess

This callback function of now.gg Payments module is triggered on successful initialization.

Return type – Void.

Usage

 NowGGPaymentsSdkManager.Instance.OnInitSuccess += OnInitSuccess;

3. OnInitFailed

This callback function of now.gg Payments module is triggered when initialization fails.

Usage

 NowGGPaymentsSdkManager.Instance.OnInitFailed += OnInitFailed;

Parameters

Type Param Description
string error Returns error associated with initialization failure.

4. PurchaseProduct

This method is used to initiate a product purchase.

Usage

public void PurchaseProduct(string productId, string developerPayload=null)
 {
     NowGGPaymentsSdkManager.Instance.PurchaseProduct(productId, developerPayload);
 }

Parameters

Type Param Description
string productId Unique identifier for the purchased product.
string developerPayload A developer-specified string that contains supplemental information about an order.

5. OnPurchaseFailed

This callback function returns the errorCode and errorMessage when the purchase fails.

Definition

public void OnPurchaseFailed(int errorCode, string errorMessage)
 {
    Debug.Log($"OnPurchaseFailed: errorCode: {errorCode} and msg: {errorMessage}");
 }

Response Codes

The table below showcases the type, response code, and response description.

Type Param Description
int 0 Indicates Successful Operation
int 1 Indicates that the process was cancelled by the user or they pressed the back button
int 2 Indicates a network issue
int 3 This indicates that the Payment API version is not supported for the type requested
int 4 Indicates that the requested item is not available for purchase
int 5 Indicates multiple scenarios, mainly: i) invalid arguments provided to the API. ii) Setup issues within now.gg Payment Service. iii) Permission issues
int 6 Indicates a fatal error during execution
int 7 Indicates that the item is already owned, purchase failure
int 8 Indicates an issue where the item is not owned and hence cannot be consumed
int -1 The service is not connected at the moment. Possible reasons could be: i) Service maintenance ii) Application in a transient state.
int -2 This indicates that the requested feature is not supported by now.gg Billing Service on that specific device
int -3 This indicates that maximum timeouts have occurred, and the billing service hasn’t responded

6. ConfirmPendingPurchase

This method is used to check for and consume any unconsumed purchases.

Definition

public void ConfirmPendingPurchase(string purchasetoken, ProductType productType) {
     if (productType == ProductType.Consumable) {
         ConsumeProduct(purchasetoken);
     } else {
         AcknowledgePurchase(purchasetoken);
     }
 }

Parameters

Type Param Description
string purchasetoken The Purchase Token generated after a successful purchase.
ProductType productType Type of product- Consumable, NonConsumable, Subscription.

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