To communicate with the PC SDK using the billing service API, the game must define a delegate function to connect to the callback of StovePCCallback class below.
public class StovePCCallback
{
public StovePCErrorDelegate OnError;
public StovePCInitializationCompleteDelegate OnInitializationComplete;
public StovePCTokenDelegate OnToken;
public StovePCUserDelegate OnUser;
public StovePCOwnershipDelegate OnOwnership;
// Callback called when FetchShopCategories processing is complete
public StovePCFetchShopCategoriesDelegate OnFetchShopCategories;
// Callback called when FetchProducts processing is complete
public StovePCFetchProductsDelegate OnFetchProducts;
// Callback called when StartPurchase processing is complete
public StovePCStartPurchaseDelegate OnStartPurchase;
// Callback called when ConfirmPurchase processing is complete
public StovePCConfirmPurchaseDelegate OnConfirmPurchase;
// Callback called when FetchInventory processing is complete
public StovePCFetchInventoryDelegate OnFetchInventory;
}
C++
복사
// Create StovePCCallback class instance
this.callback = new StovePCCallback
{
OnError = new StovePCErrorDelegate(this.OnError),
OnInitializationComplete = new StovePCInitializationCompleteDelegate(this.OnInitializationComplete),
OnToken = new StovePCTokenDelegate(this.OnToken),
OnUser = new StovePCUserDelegate(this.OnUser),
OnOwnership = new StovePCOwnershipDelegate(this.OnOwnership),
// billing service
OnFetchShopCategories = new StovePCFetchShopCategoriesDelegate(this.OnFetchShopCategories),
OnFetchProducts = new StovePCFetchProductsDelegate(this.OnFetchProducts),
OnStartPurchase = new StovePCStartPurchaseDelegate(this.OnStartPurchase),
OnConfirmPurchase = new StovePCConfirmPurchaseDelegate(this.OnConfirmPurchase),
OnFetchInventory = new StovePCFetchInventoryDelegate(this.OnFetchInventory)
};
C++
복사
You are not required to implement the OnFetchShopCategories, OnFetchProducts, OnStartPurchase, OnConfirmPurchase, OnFetchInventory callback at the start of the game - only implement it when needed from the game.
However, for the In-Game purchase to function, all 5 callbacks must be implemented and connected.