Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Sending purchased items details to the PayPal. #484

Closed
kotdroidZero opened this issue Nov 28, 2018 · 1 comment
Closed

Sending purchased items details to the PayPal. #484

kotdroidZero opened this issue Nov 28, 2018 · 1 comment

Comments

@kotdroidZero
Copy link

kotdroidZero commented Nov 28, 2018

I need to send the list of item purchased and whose payments are being done using Paypal so that the buyer as well as the vendor can see that what products have been purchased or sold. Here is the snippet of what I did for the same, by following the Github code of PayPalCheckout but I get We'are Sorry dialog each time.

And here is the code I am using.
`private PayPalPayment prepareFinalCart() {

	PayPalItem[] items = new PayPalItem[mPrograms.size()];
	double price;

	for (int i = 0; i < items.length; i++) {
		Program program = mPrograms.get(i);
		if (null != program.programPrices.get(program.selectedPriceIndex).priceAfterDiscount) {
			price = program.programPrices.get(program.selectedPriceIndex).priceAfterDiscount;
		} else {
			price = program.programPrices.get(program.selectedPriceIndex).price;
		}
		PayPalItem item = new PayPalItem(program.type, 1, //Quantity
				new BigDecimal(price), //price
				Config.DEFAULT_CURRENCY, // currency
				"sku-" + String.valueOf(program.id)); // stock keeping unit (SKU)
		items[i] = item;
	}


	// Total amount
	BigDecimal subtotal = new BigDecimal(mFinalCost);

	// If you have shipping cost, add it here
	BigDecimal shipping = new BigDecimal("0.0");

	// If you have tax, add it here
	BigDecimal tax = new BigDecimal("0.0");
    
	PayPalPaymentDetails paymentDetails = new PayPalPaymentDetails(shipping, subtotal, tax);
	BigDecimal amount = subtotal.add(shipping).add(tax);

	PayPalPayment payment = new PayPalPayment(amount, Config.DEFAULT_CURRENCY, "Total Amount: "/*programsType.toString()*/, Config.PAYMENT_INTENT);
	payment.items(items).paymentDetails(paymentDetails);

	// Custom field like invoice_number etc.,
	payment.custom("This is text that will be associated with the payment that the app can use.");

	return payment;
}`

@jaypatel512 please take a look.
47102778_2170990689619686_2702413115068252160_n 1

@braebot
Copy link
Contributor

braebot commented Jan 15, 2019

PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themselves will no longer be updated. Please use Braintree Direct in supported countries. In other countries, use Express Checkout and choose the Braintree SDK integration option.

@braebot braebot closed this as completed Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants