Store(IAP)
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.
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;
RGNCoreBuilder.AddModule(new StoreModule());
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;
}
- 1.Call Unity's IAP package's purchase event, let user buy that IAP (Handled by Native UI)
- 2.On
OnSuccessfullPurchase
event of Unity Package, call RGN'sPurchaseProduct(productId)
described bellow.
StoreModule storeModule = RGNCoreBuilder.I.GetModule<StoreModule>();
RGNUserCurrencyData currencyData = await storeModule.PurchaseProduct(productId);
You can test In app purchase integration in our demo scene in InAppPurchasesTestPopup. Screenshot below.

Purchasing
rgn-coin
works bit differently, It has it's own API called PurchaseRGNCoin(isoCurrencyCode, localizedPrice)
described follow.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
Last modified 8mo ago