This page contains information about integrating In app purchase callback to RGN SDK to add rewards in user's account.
In order to add rewards based on successful In app purchase, RGN supports it following.
We suggest user Unity's IAP Package to handle in-app purchase in Android/iOS

1. Add IAP constant in RGN Dev Dashboard

In RGN Dev Dashboard, you can add your in-app purchase with following details for each.
string id; //IAP identifier
string currencyName; //reward currency name i.e. coin
float price; //price of IAP
int quantity; //reward currency ammount
string type;
string promotionalSticker;

2. Retrieve IAP Constant in App

For this, you need to add a StoreModule in Initialization. Refer Initialize the RGN SDK​
RGNCoreBuilder.AddModule(new StoreModule());

API call:

This needs to be called only once at start and you can cache this value of RGNStoreProductsData in a variable.
StoreModule storeModule = RGNCoreBuilder.I.GetModule<StoreModule>();
RGNStoreProductsData productsData = await storeModule.GetStoreConstantData();
Here is RGNStoreProduct
public class RGNStoreProduct
public string id;
public string currencyName;
public float price;
public int quantity;
public string type;
public string promotionalSticker;

3. Buy IAP product

  1. 1.
    Call Unity's IAP package's purchase event, let user buy that IAP (Handled by Native UI)
  2. 2.
    On OnSuccessfullPurchase event of Unity Package, call RGN's PurchaseProduct(productId) described bellow.

API call:

StoreModule storeModule = RGNCoreBuilder.I.GetModule<StoreModule>();
RGNUserCurrencyData currencyData = await storeModule.PurchaseProduct(productId);
Here productId is id that you received in RGNStoreProduct 2. Retrieve IAP Constant in App ​
You can test In app purchase integration in our demo scene in InAppPurchasesTestPopup. Screenshot below.

4. Purchase rgn-coin IAP

Purchasing rgn-coin works bit differently, It has it's own API called PurchaseRGNCoin(isoCurrencyCode, localizedPrice)described follow.

API call:

StoreModule storeModule = RGNCoreBuilder.I.GetModule<StoreModule>();
RGNPurchaseRGNCoinResult purchaseRGNCoinResult = await storeModule.PurchaseRGNCoin("USD", price);
You will get isoCurrenyCode and localizedPrice from Unity IAP product's metadata. More details Browsing Product Metadata.
For now, You have to set isoCurrenyCode & localizedPrice in USD and 0.99, 1.99 or 2.99
Copy link
On this page
1. Add IAP constant in RGN Dev Dashboard
2. Retrieve IAP Constant in App
3. Buy IAP product
4. Purchase rgn-coin IAP