Skip to content

Consumption

Mansour edited this page Aug 3, 2021 · 2 revisions



You can consume a product just by calling Consume function in Payment class:

purchaseToken -> You get this token in data of purchase result on previous step, when player purchases a product. Also you can simple query purchased products by that particular player, using getPurchasedProducts in Payment class, which also gives you purchaseToken to consume. You can read more about querying purchased products from here.

Using async :

var result = await payment.Consume(purchaseToken);
Debug.Log($"{result.message}, {result.stackTrace}");

Using callback :

_ = payment.Consume(purchaseToken, OnConsumeComlete);

void OnConsumeComlete(Result result)
{
    Debug.Log($"{result.message}, {result.stackTrace}");
}