示例#1
0
        private void TrackPurchase()
        {
            var builder = PurchaseData.CreateBuilder();

            builder.WithProductId(_productId);
            builder.WithProductTitle(_productTitle);
            builder.WithPriceCurrency(_priceCurrency);
            builder.WithPrice(float.Parse(_priceStr));
            if (_productTypeStr.Equals("item"))
            {
                builder.WithProductType(PurchaseData.ProductType.Item);
            }
            else
            {
                builder.WithProductType(PurchaseData.ProductType.Subscription);
            }
            builder.WithPurchaseDate(DateTime.Now);
            builder.WithPurchaseId(System.Guid.NewGuid().ToString());

            if (GetSocial.TrackPurchaseEvent(builder.Build()))
            {
                _console.LogD("Purchase was tracked.");
            }
            else
            {
                _console.LogD("Purchase tracking failed.");
            };
        }