Exemple #1
0
        /// <summary>
        /// Launches the purchase flow of a <see cref="Kiln.Product"/>. If the platform doesn't support
        /// In App Purchases (check <see cref="SupportsIAP"/>) the Task will get an <see cref="Kiln.Exception"/>
        /// </summary>
        /// <param name="productID">Identifier of the <see cref="Kiln.Product"/> to be purchased</param>
        /// <param name="payload">Additional data to send with the purchase</param>
        /// <returns>Task that'll return a <see cref="Kiln.Purchase"/> upon successful completion</returns>
        public static Task <IPurchase> PurchaseProduct(string productID, string payload)
        {
#if ANDROID_DEVICE
            return(Bridge.PurchaseProduct(productID, payload));
#else
            CheckInitialized();

            if (!SupportsIAP())
            {
                throw new Kiln.Exception("In App Purchases not supported.");
            }

            var task = _iap.PurchaseProduct(productID, payload);

            return(task);
#endif
        }