Once the user has selected a product for purchase, we can start the checkout process.
When we have obtained a list of products, we can present the user with the opportunity to make a purchase. There are two ways to make a purchase, either using a Product
instance or just the product ID:
The
QueryInventoryAsync()
method returns a list of:var products = await billing.QueryInventoryAsync( new [] { "managed.one" }, ItemType.Product); var product = products[0]; billing.BuyProduct(product);
This method also has an overload that accepts a
string
payload that will be included with any server responses:billing.BuyProduct(product, "DeveloperPayload");
Another way to purchase a product is to simply pass the product ID to the
BuyProduct()
method along with the product type and an optional payload:billing.BuyProduct( "managed.one", ItemType.Product, "DeveloperPayload");
After the purchase has been made, we will be notified about the success, or failure, of the purchase...