public void PayPalButtonClick(View arg0) { dialog.hide(); // Create a basic PayPal payment PayPalPayment payment = new PayPalPayment(); // Set the currency type payment.setCurrencyType("USD"); // Set the recipient for the payment (can be a phone number) payment.setRecipient("*****@*****.**"); // Set the payment amount, excluding tax and shipping costs payment.setSubtotal(new BigDecimal(cost.getAmount())); // Set the payment type--his can be PAYMENT_TYPE_GOODS, // PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); // PayPalInvoiceData can contain tax and shipping amounts, and an // ArrayList of PayPalInvoiceItem that you can fill out. // These are not required for any transaction. PayPalInvoiceData invoice = new PayPalInvoiceData(); // Set the tax amount invoice.setTax(new BigDecimal(0)); PayPalInvoiceItem item = new PayPalInvoiceItem(); item.setID("1"); item.setName(cost.getCategory().getName()); item.setTotalPrice(new BigDecimal(cost.getAmount())); item.setQuantity(1); ArrayList<PayPalInvoiceItem> items = new ArrayList<>(); items.add(item); invoice.setInvoiceItems(items); payment.setMerchantName("House Share"); payment.setInvoiceData(invoice); Intent checkoutIntent = PayPal.getInstance().checkout(payment, this.getContext()); startActivityForResult(checkoutIntent, REQUEST_PAYPAL_CHECKOUT); }