#0xwess

1 messages · Page 1 of 1 (latest)

obsidian flameBOT
stuck oasis
#

Hi, my colleague had to step away, do you mind summarising the question for me please?

untold valve
#

Sure, Im selling multiple pictures for the same price, how to structure best my case?

On the checkout page I want them to be able to see the picture they are purchasing, each picture is unique though.

So on the server side when generating a scheckout session await stripe.checkout.sessions.create({, should I

  1. first create a new product, and then reference an existing price,
    or
  2. use
 line_items: [
      {
        // price: process.env.PRICE,
        price_data: {
          currency: 'usd',
          unit_amount: 1000,
          product_data: {
            name: 'Product name ...',
            images: [
              'https://picsum.photos/280/320?random=4',
              'https://picsum.photos/280/320?random=2',
            ],
          },
        },
        quantity: quantity,
        description: 'My description ...',
      },
    ],

which approach should i take? 1? or 2?

stuck oasis
#

2 is easier if you are not planning to reuse the Products/Prices.

#

Or if you have too many Products that would be otherwise hard to manage.

untold valve
#

concerned that it will end up with multiple Prices objects being created tho, they will all cost the same price, hence the concern

#

Or is it okay?

stuck oasis
#

Both approaches are valid, but for case 1 you need to count in the overhead of managing the Products.

#

I would say, if you have much more various products than times you will reuse each of them, it makes more sense to use price_data/product_data

untold valve
#

Thanks, gotcha

stuck oasis
#

Happy to help!