- Home /
In-App Purchase callbacks code implementation
I'm trying to implement a simple in-app purchase for a non-consumable (unlock level). But, i'm having trouble using the StoreKitManager callbacks from Apple. I'm using the StoreKit from geniteam.
At a certain point in the game a paywall comes up with buttons, one of which, I'm scripting like this:
void OnClick()
{
#if UNITY_IPHONE
if(StoreKitBinding.canMakePayments() == true)
{
Debug.Log("RequestProductData Clicked");
string[] productIDs = { "com.myAppId.NonConsumable" };
StoreKitBinding.requestProductData(productIDs);
Debug.Log("MakePurchase Clicked");
StoreKitBinding.purchaseProduct("com.myAppId.NonConsumable");
}
#endif
}
The callback from Apple will fire a static public method: StoreKitManager.productsPurchaseSuccessEvent();
The question is how do I handle the static method? Should I put the static method StoreKitManager.productsPurchaseSuccessEvent(); in my game script and access the non-static methods with an instance of the script: GameScript gameScript = new GameScript();
is that the way to go about this???? There is little info out there about how to actually implement code into one's game.
Thanks for any help anyone has to offer.
Your answer