If you want to deliver some items that have been purchased to user, you should implement this handler.
You can receive a GamebaseResponse.Purchase.PurchasableReceipt object and receive whether error or success by callback. This API return same information with 'RequestPurchase' You should call this method after logged in
, and you should call this before an other APIs in Gamebase.Purchase
. This API can work on iOS11 or later.
public void SetPromotionIAPHandlerSample()
{
{
if (Gamebase.IsSuccess(error) == true)
{
Gamebase.Purchase.SetPromotionIAPHandler((purchasableReceipt, innerError) =>
{
if (Gamebase.IsSuccess(innerError) == true)
{
Debug.Log("SetPromotionIAPHandler succeeded");
var message = new StringBuilder();
message.AppendLine(string.Format("itemSeq:{0}", purchasableReceipt.itemSeq));
message.AppendLine(string.Format("price:{0}", purchasableReceipt.price));
message.AppendLine(string.Format("currency:{0}", purchasableReceipt.currency));
message.AppendLine(string.Format("paymentSeq:{0}", purchasableReceipt.paymentSeq));
message.AppendLine(string.Format("purchaseToken:{0}", purchasableReceipt.purchaseToken));
Debug.Log(message);
}
else
{
if (innerError.code == GamebaseErrorCode.PURCHASE_USER_CANCELED)
{
Debug.Log("User canceled purchase.");
}
else
{
Debug.Log(string.Format("SetPromotionIAPHandler failed. innerError is {0}", innerError));
}
}
});
}
else
{
Debug.Log(string.Format("Login failed. error is {0}", error));
}
});
}
static void Login(string providerName, GamebaseCallback.GamebaseDelegate< GamebaseResponse.Auth.AuthToken > callback)
Try to authenticate by specifying an IdP type.
Definition Gamebase.cs:611
The Gamebase class is core of Gamebase service.
Definition Gamebase.cs:11