This document contains the reference for NowGGPaymentsSdkManager
class and its methods.
Property:
Instance – Returns the instance of the class.
The following public method references are provided:
This method is used to Initialize the now.gg Payments module with provided arguments.
Usage
NowGGPaymentsSdkManager.Instance.InitializeIap(PAYMENT_ID, IN_GAME_ID)
Type | Param | Description |
---|---|---|
string | PAYMENT_ID | App-specific ID to enable now.gg Payments |
string | IN_GAME_ID | Unique identifier for your user. |
This callback function of now.gg Payments module is triggered on successful initialization.
Return type – Void.
Usage
NowGGPaymentsSdkManager.Instance.OnInitSuccess += OnInitSuccess;
This callback function of now.gg Payments module is triggered when initialization fails.
Usage
NowGGPaymentsSdkManager.Instance.OnInitFailed += OnInitFailed;
Type | Param | Description |
---|---|---|
string | error | Returns error associated with initialization failure. |
This method is used to initiate a product purchase.
Usage
public void PurchaseProduct(string productId, string developerPayload=null) { NowGGPaymentsSdkManager.Instance.PurchaseProduct(productId, developerPayload); }
Type | Param | Description |
---|---|---|
string | productId | Unique identifier for the purchased product. |
string | developerPayload | A developer-specified string that contains supplemental information about an order. |
This callback function returns the errorCode and errorMessage when the purchase fails.
public void OnPurchaseFailed(int errorCode, string errorMessage) { Debug.Log($"OnPurchaseFailed: errorCode: {errorCode} and msg: {errorMessage}"); }
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. |
int | 100 | INVALID_PAYMENT_ID – This indicates that Payment ID is invalid. |
int | 101 | PRODUCT_NOT_FOUND_ON_STUDIO – This indicated that the product was not found on nowStudio. |
int | 102 | INVALID_PURCHASE_TOKEN – This indicates that the provided purchase token is invalid. |
int | 103 | PRODUCT_ALREADY_CONSUMED – This indicates that the product is already consumed. |
int | 104 | PRODUCT_ALREADY_ACKNOWLEDGED – This indicates that the product is already acknowledged. |
int | 105 | PRODUCT_NOT_CONSUMED – This indicates that the purchased product was not consumed. |
int | 106 | ACTIVE_SUBSCRIPTION_CANNOT_BE_PURCHASED_AGAIN – This indicates that an active subscription cannot be purchased again. |
int | 107 | NO_VALID_SUBSCRIPTION_FOUND – This indicates that a valid subscription was not found. |
int | 108 | PAYMENT_FAILED – This indicates that the Payment has failed. |
int | 109 | PAYMENT_CANCELLED – This indicates that the Payment was cancelled. |
int | 110 | PAYMENT_TIMEOUT – This indicates that a timeout with the Payment. |
int | 1000 | INTERNAL_ERROR – This indicates that an internal error has occured. |
This method is used to check for and consume any unconsumed purchases.
public void ConfirmPendingPurchase(string purchasetoken, ProductType productType) { if (productType == ProductType.Consumable) { ConsumeProduct(purchasetoken); } else { AcknowledgePurchase(purchasetoken); } }
Type | Param | Description |
---|---|---|
string | purchasetoken | The Purchase Token generated after a successful purchase. |
ProductType | productType | Type of product- Consumable, NonConsumable, Subscription. |
Payments Module
Payments Module
Document Rev. 1.0