Example #1
0
        partial void actPay(NSObject sender)
        {
            // Remove our last completed payment, just for demo purposes.
            CompletedPayment = null;

            var payment = new PayPalPayment
            {
                Amount           = new NSDecimalNumber("9.95"),
                CurrencyCode     = "USD",
                ShortDescription = "Hipster t-shirt",
                Intent           = PayPalPaymentIntent.Sale
            };

            if (!payment.Processable)
            {
                // This particular payment will always be processable. If, for
                // example, the amount was negative or the shortDescription was
                // empty, this payment wouldn't be processable, and you'd want
                // to handle that here.
            }

            _payPalConfig.AcceptCreditCards = AcceptCreditCards;

            _samplePayPalPaymentDelegate = new SamplePayPalPaymentDelegate(this);
            _paymentViewController       = new PayPalPaymentViewController(payment, _payPalConfig, _samplePayPalPaymentDelegate);

            if (_paymentViewController.Handle == IntPtr.Zero)
            {
                Debug.WriteLine("Failed to create PayPalPaymentViewController.");
                return;
            }

            PresentViewController(_paymentViewController, true, null);
        }
        partial void actPay(NSObject sender)
        {
            // Remove our last completed payment, just for demo purposes.
            this.CompletedPayment = null;

            var payment = new PayPalPayment()
            {
                Amount           = new NSDecimalNumber("9.95"),
                CurrencyCode     = "USD",
                ShortDescription = "Hipster t-shirt"
            };

            if (!payment.Processable)
            {
                // This particular payment will always be processable. If, for
                // example, the amount was negative or the shortDescription was
                // empty, this payment wouldn't be processable, and you'd want
                // to handle that here.
            }

            // Any customer identifier that you have will work here. Do NOT use a device- or
            // hardware-based identifier.
            string customerId = "user-11723";

            // Set the environment:
            // - For live charges, use PayPalEnvironmentProduction (default).
            // - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
            // - For testing, use PayPalEnvironmentNoNetwork.
            PayPalPaymentViewController.Environment = this.Environment;
            samplePayPalPaymentDelegate             = new SamplePayPalPaymentDelegate(this);

            paymentViewController = new PayPalPaymentViewController(kPayPalClientId,
                                                                    kPayPalReceiverEmail,
                                                                    customerId,
                                                                    payment,
                                                                    samplePayPalPaymentDelegate);

            if (paymentViewController.Handle == IntPtr.Zero)
            {
                Debug.WriteLine("Failed to create PayPalPaymentViewController.");
                return;
            }

            paymentViewController.HideCreditCardButton = !this.AcceptCreditCards;

            // Setting the languageOrLocale property is optional.
            //
            // If you do not set languageOrLocale, then the PayPalPaymentViewController will present
            // its user interface according to the device's current language setting.
            //
            // Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
            // locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
            // to use that language/locale.
            //
            // For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
            paymentViewController.LanguageOrLocale = "en";

            this.PresentViewController(paymentViewController, true, null);
        }
partial         void actPay(NSObject sender)
        {
            // Remove our last completed payment, just for demo purposes.
            this.CompletedPayment = null;

            var payment = new PayPalPayment () {
                Amount = new NSDecimalNumber("9.95"),
                CurrencyCode = "USD",
                ShortDescription = "Hipster t-shirt"
            };

            if (!payment.Processable) {
                // This particular payment will always be processable. If, for
                // example, the amount was negative or the shortDescription was
                // empty, this payment wouldn't be processable, and you'd want
                // to handle that here.
            }

            // Any customer identifier that you have will work here. Do NOT use a device- or
            // hardware-based identifier.
            string customerId = "user-11723";

            // Set the environment:
            // - For live charges, use PayPalEnvironmentProduction (default).
            // - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
            // - For testing, use PayPalEnvironmentNoNetwork.
            PayPalPaymentViewController.Environment = this.Environment;
            samplePayPalPaymentDelegate = new SamplePayPalPaymentDelegate (this);

            paymentViewController = new PayPalPaymentViewController (kPayPalClientId,
                                                                    kPayPalReceiverEmail,
                                                                    customerId,
                                                                    payment,
                                                                    samplePayPalPaymentDelegate);

            if (paymentViewController.Handle == IntPtr.Zero) {
                Debug.WriteLine ("Failed to create PayPalPaymentViewController.");
                return;
            }

            paymentViewController.HideCreditCardButton = !this.AcceptCreditCards;

            // Setting the languageOrLocale property is optional.
            //
            // If you do not set languageOrLocale, then the PayPalPaymentViewController will present
            // its user interface according to the device's current language setting.
            //
            // Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
            // locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
            // to use that language/locale.
            //
            // For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
            paymentViewController.LanguageOrLocale = "en";

            this.PresentViewController (paymentViewController, true, null);
        }
partial         void actPay(NSObject sender)
        {
            // Remove our last completed payment, just for demo purposes.
            CompletedPayment = null;

            var payment = new PayPalPayment
            {
                Amount = new NSDecimalNumber("9.95"),
                CurrencyCode = "USD",
                ShortDescription = "Hipster t-shirt",
                Intent = PayPalPaymentIntent.Sale
            };

            if (!payment.Processable) {
                // This particular payment will always be processable. If, for
                // example, the amount was negative or the shortDescription was
                // empty, this payment wouldn't be processable, and you'd want
                // to handle that here.
            }

            _payPalConfig.AcceptCreditCards = AcceptCreditCards;

            _samplePayPalPaymentDelegate = new SamplePayPalPaymentDelegate(this);
            _paymentViewController = new PayPalPaymentViewController(payment, _payPalConfig, _samplePayPalPaymentDelegate);

            if (_paymentViewController.Handle == IntPtr.Zero) {
                Debug.WriteLine ("Failed to create PayPalPaymentViewController.");
                return;
            }

            PresentViewController (_paymentViewController, true, null);
        }