private PayPalRest.Payment CreatePayPalPayment(ProcessPaymentRequest request, PayPalConfig settings)
        {
            var config = new Dictionary<string, string>();
            config.Add("mode", settings.SandboxMode ? "sandbox" : "live");

            var credentials = new OAuthTokenCredential(settings.ClientId, settings.ClientSecret, config);
            var accessToken = credentials.GetAccessToken();
            var payment = new PayPalRest.Payment
            {
                intent = "sale",
                payer = new Payer
                {
                    payment_method = "credit_card",
                    funding_instruments = new List<PayPalRest.FundingInstrument>
                    {
                        new PayPalRest.FundingInstrument
                        {
                            credit_card = CreateCreditCard(request)
                        }
                    }
                },
                transactions = new List<Transaction> { CreateTransaction(request) }
            };

            return payment.Create(new APIContext(accessToken)
            {
                Config = config
            });
        }
        private PayPalRest.Payment CreatePayPalPayment(PaymentProcessingContext request, PayPalConfig settings)
        {
            var config = new Dictionary <string, string>();

            config.Add("mode", settings.SandboxMode ? "sandbox" : "live");

            var credentials = new OAuthTokenCredential(settings.ClientId, settings.ClientSecret, config);
            var accessToken = credentials.GetAccessToken();
            var payment     = new PayPalRest.Payment
            {
                intent = "sale",
                payer  = new Payer
                {
                    payment_method      = "credit_card",
                    funding_instruments = new List <PayPalRest.FundingInstrument>
                    {
                        new PayPalRest.FundingInstrument
                        {
                            credit_card = CreateCreditCard(request)
                        }
                    }
                },
                transactions = new List <Transaction> {
                    CreateTransaction(request)
                }
            };

            return(payment.Create(new APIContext(accessToken)
            {
                Config = config
            }));
        }