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 create an order with multiple items? [QUESTION] #113

Open
mpbunch opened this issue Aug 7, 2021 · 2 comments
Open

How to create an order with multiple items? [QUESTION] #113

mpbunch opened this issue Aug 7, 2021 · 2 comments

Comments

@mpbunch
Copy link

mpbunch commented Aug 7, 2021

To Do First

  • [ x ] Take a look in the README
  • [ x ] Take a look in the docs

Ask your Question
I have a form where users can select some quantity or product.
For example: 1 sock or 10 socks.

Sure I can sock.quantity * sock.price = payapl.amount
But within paypal it then shows quantity 1 at a rate of total.
The merchant doesn't know if this is 1 expensive sock, or 10 cheap socks.

Tags
Quantity, Multiple Products, Multiple Items

@mpbunch
Copy link
Author

mpbunch commented Aug 8, 2021

Hope this helps someone else.

        createOrder={(data, actions) => {
            return actions.order.create({
                purchase_units: [
                    {
                        reference_id: "some_id",
                        description: `Some description ${this.state.something}`,
                        custom_id: "some_value_will_show_up_in_the_pay_pal_interface",
                        soft_descriptor: "product description",
                        amount: {
                            currency_code: "USD",
                            value: "20.00",
                            breakdown: {
                                item_total: {
                                    currency_code: "USD",
                                    value: "20.00"
                                }
                            }
                        },
                        items: [
                            {
                                name: "ITEM 1",
                                description: `ITEM 1 DESC: ${this.state.description}`,
                                sku: {this.state.item.skew},
                                unit_amount: {
                                    currency_code: "USD",
                                    value: "20.00"
                                },
                                quantity: this.state.quantity
                            },
                        ]
                    }
                ],
                application_context: {
                    shipping_preference: 'NO_SHIPPING'
                }
            })
        }}

@jayenashar
Copy link

is there not a way to tell paypal it's 10 pairs of socks and paypal already knows the unit price of each pair?

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