Beispiel #1
0
        public void PurchaseProduct(string productId)
        {
            try
            {
                // In case we need to process a delayed payment, otherwise our HandleActivityResult below will handle
                MpUtils.EnablePaymentBroadcast(Android.App.Application.Context, "com.simsip.permission.PAYMENT_BROADCAST_PERMISSION");

                PaymentRequest.PaymentRequestBuilder builder = new PaymentRequest.PaymentRequestBuilder();

                builder.SetService(FortumoInAppService._serviceId, FortumoInAppService._inAppSecret);

                // TODO
                var practiceText = string.Empty;
                builder.SetDisplayString(practiceText);

                // Non-consumable purchases are restored using this value
                builder.SetProductName(FortumoInAppService._productName);

                // Non-consumable items can be later restored
                builder.SetType(MpUtils.ProductTypeNonConsumable);

                builder.SetIcon(Resource.Drawable.icon);

                PaymentRequest pr = builder.Build();

                // Can be anything
                int REQUEST_CODE = 1234;

                MainActivity.Instance.StartActivityForResult(pr.ToIntent(Android.App.Application.Context), REQUEST_CODE);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception in PurchaseProduct: " + ex);
            }
        }
        public void PurchaseProduct(string productId)
        {
            try
            {
                // In case we need to process a delayed payment, otherwise our HandleActivityResult below will handle
                MpUtils.EnablePaymentBroadcast(Android.App.Application.Context, "com.simsip.permission.PAYMENT_BROADCAST_PERMISSION");

                PaymentRequest.PaymentRequestBuilder builder = new PaymentRequest.PaymentRequestBuilder();

                builder.SetService(FortumoInAppService._serviceId, FortumoInAppService._inAppSecret);

                // TODO
                var practiceText = string.Empty;
                builder.SetDisplayString(practiceText);

                // Non-consumable purchases are restored using this value
                builder.SetProductName(FortumoInAppService._productName);

                // Non-consumable items can be later restored
                builder.SetType(MpUtils.ProductTypeNonConsumable);

                builder.SetIcon(Resource.Drawable.icon);

                PaymentRequest pr = builder.Build();

                // Can be anything
                int REQUEST_CODE = 1234;

                MainActivity.Instance.StartActivityForResult(pr.ToIntent(Android.App.Application.Context), REQUEST_CODE);
            }
            catch(Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception in PurchaseProduct: " + ex);
            }
        }