//het aanmaken van een payment voor paypal van een walletorder: de te betalen payment volgens paypal vereisten. private Payment CreatePayment(APIContext apiContext, string redirectUrl, WalletOrder order) { //eff tijdelijk test ding var itemList = new ItemList() { items = new List<Item>() }; itemList.items.Add(new Item() { name = "Oplading van Wallet", currency = "EUR", price = order.TotalAmount.ToString(), quantity = "1", sku = order.OrderId.ToString() }); var payer = new Payer() { payment_method = "paypal" }; var redirUrls = new RedirectUrls() { cancel_url = redirectUrl, return_url = redirectUrl }; var details = new Details() { tax = "0", shipping = "0", subtotal = order.TotalAmount.ToString() }; var amount = new Amount() { currency = "EUR", total = order.TotalAmount.ToString(), details = details }; var transactionList = new List<Transaction>(); transactionList.Add(new Transaction() { description = "Betaling van een oplading", invoice_number = order.OrderId.ToString(), amount = amount, item_list = itemList }); this.payment = new Payment() { intent = "sale", payer = payer, transactions = transactionList, redirect_urls = redirUrls }; return this.payment.Create(apiContext); }
//het effectief uitvoeren van de Paypal betaling private Payment ExecutePayment(APIContext apiContext, string payerId, string paymentId) { var paymentExecution = new PaymentExecution() { payer_id = payerId }; this.payment = new Payment() { id = paymentId }; return this.payment.Execute(apiContext, paymentExecution); }