Reputation: 814
I am integrating PayPal new SDK. I have successfully integrate new SDK in my code. Single item successfully done. But I want to multiple item than how to integrate.
public void onBuyPressed(View pressed) {
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal("100.0"), "USD", "hipster jeans");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, 0);
}
Upvotes: 2
Views: 1100
Reputation: 1167
With the updated SDK, you can specific more items this way:
PayPalItem ppi1 = new PayPalItem("Item 1", 1, new BigDecimal(100.0), "USD", "Pid1");
PayPalItem ppi2 = new PayPalItem("Item 2", 1, new BigDecimal(100.0), "USD", "Pid2");
PayPalItem[] ppis = new PayPalItem[]{ppi1, ppi2};
// this is optional, for specifing extra costs
PayPalPaymentDetails pd = new PayPalPaymentDetails(
PayPalItem.getItemTotal(ppis), // price
new BigDecimal(10.0), // shipment costs
new BigDecimal(0) // taxes
);
PayPalPayment payment = new PayPalPayment(
new BigDecimal(210.0), "USD", "Item 1 and 2", PayPalPayment.PAYMENT_INTENT_SALE);
payment.items(ppis);
payment.paymentDetails(pd);
Intent intent = new Intent(MainActivity.this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
startActivityForResult(intent, 0);
Translated for Android from the iOS demo :)
Upvotes: 1
Reputation: 157
The current support is not available by paypal mobile sdks. I did query on github paypal forum, you can verify here : https://github.com/paypal/PayPal-Android-SDK/issues/30
Upvotes: 0