Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add multiple items #5

Open
anilani27 opened this issue Feb 13, 2020 · 1 comment
Open

How to add multiple items #5

anilani27 opened this issue Feb 13, 2020 · 1 comment

Comments

@anilani27
Copy link

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

@roy-sandip
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants