public void BuyItem(PayPalForms.PayPalItem item, Decimal xftax, PayPalForms.PaymentIntent xfintent, Action onCancelled, Action <string> onSuccess, Action <string> onError, PayPalForms.ShippingAddress address)
        {
            _onCancelled = onCancelled;
            _onSuccess   = onSuccess;
            _onError     = onError;

            BigDecimal amount = new BigDecimal(RoundNumber((double)item.Price)).Add(new BigDecimal(RoundNumber((double)xftax)));
            string     paymentIntent;

            switch (xfintent)
            {
            case PayPalForms.PaymentIntent.Authorize:
                paymentIntent = PayPalPayment.PaymentIntentAuthorize;
                break;

            case PayPalForms.PaymentIntent.Order:
                paymentIntent = PayPalPayment.PaymentIntentOrder;
                break;

            default:
            case PayPalForms.PaymentIntent.Sale:
                paymentIntent = PayPalPayment.PaymentIntentSale;
                break;
            }
            PayPalPayment payment = new PayPalPayment(amount, item.Currency, item.Name, paymentIntent);

            if (address != null)
            {
                ShippingAddress shippingAddress = new ShippingAddress()
                                                  .RecipientName(address.RecipientName)
                                                  .Line1(address.Line1)
                                                  .Line2(address.Line2)
                                                  .City(address.City)
                                                  .State(address.State)
                                                  .PostalCode(address.PostalCode)
                                                  .CountryCode(address.CountryCode);
                payment = payment.InvokeProvidedShippingAddress(shippingAddress);
            }
            switch (_formsConfig.ShippingAddressOption)
            {
            case Abstractions.ShippingAddressOption.Both:
            case Abstractions.ShippingAddressOption.PayPal:
                payment = payment.EnablePayPalShippingAddressesRetrieval(true);
                break;

            default:
                payment = payment.EnablePayPalShippingAddressesRetrieval(false);
                break;
            }
            Intent intent = new Intent(Context, typeof(PaymentActivity));

            intent.PutExtra(PayPalService.ExtraPaypalConfiguration, _nativeConfig);
            intent.PutExtra(PaymentActivity.ExtraPayment, payment);
            (Context as Activity).StartActivityForResult(intent, REQUEST_CODE_PAYMENT);
        }
        public void BuyItems(PayPalForms.PayPalItem[] items, Decimal xfshipping, Decimal xftax, PayPalForms.PaymentIntent xfintent, Action onCancelled, Action <string> onSuccess, Action <string> onError, PayPalForms.ShippingAddress address)
        {
            _onCancelled = onCancelled;
            _onSuccess   = onSuccess;
            _onError     = onError;

            List <PayPalItem> nativeItems = new List <PayPalItem>();

            foreach (var product in items)
            {
                nativeItems.Add(new PayPalItem(
                                    product.Name,
                                    new Java.Lang.Integer((int)product.Quantity),
                                    new BigDecimal(RoundNumber((double)product.Price)),
                                    product.Currency,
                                    product.SKU)
                                );
            }
            BigDecimal           subtotal       = PayPalItem.GetItemTotal(nativeItems.ToArray());
            BigDecimal           shipping       = new BigDecimal(RoundNumber((double)xfshipping));
            BigDecimal           tax            = new BigDecimal(RoundNumber((double)xftax));
            PayPalPaymentDetails paymentDetails = new PayPalPaymentDetails(shipping, subtotal, tax);
            BigDecimal           amount         = subtotal.Add(shipping).Add(tax);
            string paymentIntent;

            switch (xfintent)
            {
            case PayPalForms.PaymentIntent.Authorize:
                paymentIntent = PayPalPayment.PaymentIntentAuthorize;
                break;

            case PayPalForms.PaymentIntent.Order:
                paymentIntent = PayPalPayment.PaymentIntentOrder;
                break;

            default:
                paymentIntent = PayPalPayment.PaymentIntentSale;
                break;
            }
            PayPalPayment payment = new PayPalPayment(amount, nativeItems.FirstOrDefault().Currency, "Multiple items", paymentIntent);

            payment = payment.Items(nativeItems.ToArray()).PaymentDetails(paymentDetails);
            if (address != null)
            {
                ShippingAddress shippingAddress = new ShippingAddress()
                                                  .RecipientName(address.RecipientName)
                                                  .Line1(address.Line1)
                                                  .Line2(address.Line2)
                                                  .City(address.City)
                                                  .State(address.State)
                                                  .PostalCode(address.PostalCode)
                                                  .CountryCode(address.CountryCode);
                payment = payment.InvokeProvidedShippingAddress(shippingAddress);
            }
            switch (_formsConfig.ShippingAddressOption)
            {
            case Abstractions.ShippingAddressOption.Both:
            case Abstractions.ShippingAddressOption.PayPal:
                payment = payment.EnablePayPalShippingAddressesRetrieval(true);
                break;

            default:
                payment = payment.EnablePayPalShippingAddressesRetrieval(false);
                break;
            }
            Intent intent = new Intent(Context, typeof(PaymentActivity));

            intent.PutExtra(PayPalService.ExtraPaypalConfiguration, _nativeConfig);
            intent.PutExtra(PaymentActivity.ExtraPayment, payment);
            (Context as Activity).StartActivityForResult(intent, REQUEST_CODE_PAYMENT);
        }