#mxd

1 messages ยท Page 1 of 1 (latest)

elfin smeltBOT
drowsy peak
#

Hi ๐Ÿ‘‹

You can create products through the Dashboard or the API

vocal stream
#

        checkout_session = stripe.checkout.Session.create(
            line_items=[
                {
                    'price': 'price_1LxHGMLOEVMWAWDDhKcCCxXC',
                    'quantity': 1,
                },
            ],
            mode='subscription',
            success_url=YOUR_DOMAIN +
            '/success.html?session_id={CHECKOUT_SESSION_ID}',
            cancel_url=YOUR_DOMAIN + '/cancel.html',
        )#----------------------------------------------create a checkout session```
drowsy peak
#

No you would need to create the Products and their prices in your Stripe Account

vocal stream
#

i did that part

drowsy peak
#

Okay, so what is the question exactly?

vocal stream
#

after that, what do I need to change in the code?

#

im working off the quickstart

drowsy peak
#

What are you trying to do? Have you read through our docs on how to set up a checkout session?

vocal stream
#

yes

#

well

#

the quickstart works for 1 product

#

but how can I do 3 products?

drowsy peak
#

Add 3 line items

#

But that is all covered in detail in the rest of our docs

vocal stream
#

in the quickstart?

drowsy peak
#

The rest of our docs, not just the quickstart

vocal stream
#

Oh like this: {
'price': 'price_CBXbz9i7AIOTzr',
},
{
'price': 'price_IFuCu48Snc02bc',
'quantity': 2,
},

drowsy peak
#

We have many more pages on how to do this and I would recommend reading them

vocal stream
#

so the issue Im running into is the front end

drowsy peak
#

How so?

vocal stream
#
  <!-- Add a hidden field with the lookup_key of your price-->
  <input type="hidden" name="lookup_key" value="{{PRICE_LOOKUP_KEY}}" />
  <button id="checkout-and-portal-button" type="submit">Checkout</button>
</form>```
#

so the variation will be the value="" ?

#

i put the price_ndibfiebh thing there ?

#

it doesn't mention what to do on the frontend side

#

just the backend

drowsy peak
#

Yup, put the price ID where it says {{PRICE_LOOKUP_KEY}}

#

That will pass back 1 price ID to server.py

vocal stream
#

understood, so does name="lookup_key" need to be changed?

drowsy peak
#

All that does is change what the key is that you use to look up the value.

lookup_keys=[request.form['lookup_key']], # <- this is "lookup_key"
vocal stream
#

ok

#

thank you Snufkin

drowsy peak
#

Happy to help ๐Ÿ™‚