#tetthys
1 messages ยท Page 1 of 1 (latest)
Hi there!
This is a price object: https://stripe.com/docs/api/prices
usually you create a product first, then you add prices to the product. Both can be created with the API or directly in the dashboard.
and you pass the price ID to the Checkout Session
Also note that you don't have to use a price ID, you could also dynamically create a price like this https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers
Thanks, I also have a question. When and Where should I use publishable key??? The secret key is used on server side, right??
Hi ๐ I'm jumping in as my teammate needed to step away. You're correct, secret keys are used for server-side code, while your publishable key is used within your client-side code.
Can you show me client side code example??
Or official docs??
Are you still looking at the Checkout Session example that you linked initially? That flow doesn't require the use of your publishable key.
Your client-side code will need to have your publishable key if you're embedding Stripe Elements or Stripe.js into it.
For instance, you see it used in this section where the documentation talks about setting up client-side coding to use our Payment Element:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-collect-payment-details