paypal-payment-gateway-integration-laravel icon indicating copy to clipboard operation
paypal-payment-gateway-integration-laravel copied to clipboard

How to add multiple items

Open anilani27 opened this issue 5 years ago • 1 comments
trafficstars

How to add multiple item in paypal request and also how to pass custom values.

anilani27 avatar Feb 13 '20 12:02 anilani27

You can do that by creating multiple item instances.

$item_1 = new Item();
$item_1->setName('Item 1') /** item name **/
            ->setCurrency('USD')
            ->setQuantity(1)
            ->setPrice(6.5); /** unit price **/
$item_list = new ItemList();
        $item_list->setItems(array($item_1));

$item_2 = new Item();
$item_2->setName('Item 2') /** item name **/
            ->setCurrency('USD')
            ->setQuantity(1)
            ->setPrice(23.5); /** unit price **/
$item_list = new ItemList();
        $item_list->setItems(array($item_1, $item_2));

$amount = new Amount();
        $amount->setCurrency('USD')
            ->setTotal(30); // $itme_1 + $item_2 total price

roy-sandip avatar Jun 17 '20 21:06 roy-sandip