LeisureLlama
LeisureLlama
TTCTheo's Typesafe Cult
Created by shvz on 8/26/2023 in #questions
Stripe how to handle multiple price_id?
Awesome, glad I could help!
6 replies
TTCTheo's Typesafe Cult
Created by shvz on 8/26/2023 in #questions
Stripe how to handle multiple price_id?
I am a little bit confused about what exactly you are trying to do here, but let me see if I can help a bit. If you want to pass custom data to a stripe checkout page, instead of sending a price_ID, you can send an object with the data you want. This would be a price data object. Here is about how I did it in my project.
line_items: [
price_data: {
currency: *what currency you want, for example "usd"*,
product_data: {
name: *product name here*
images: *url to img*
},
unit_amount: *put price here*
},
quantity: *number of items*,
line_items: [
price_data: {
currency: *what currency you want, for example "usd"*,
product_data: {
name: *product name here*
images: *url to img*
},
unit_amount: *put price here*
},
quantity: *number of items*,
I cant find the page in the docs that has the info for this, but this page should be helpful https://stripe.com/docs/payments/checkout/migrating-prices If this does not work for you, you might have to pass the different price_id from the frontend into the backend in your request, so that you can send that to stripe. I did that through a checkout sessions handler that my cart pushes to. Hopefully some of this helps, if not let me know!
6 replies
TTCTheo's Typesafe Cult
Created by LeisureLlama on 8/20/2023 in #questions
Struggling to Integrate Stripe for Payments in TypeScript Next.js E-Commerce App
This is probably not best practice, but to get around the type issues on the Stripe provided code, I put /* eslint-disable */ on the top of the page, and made everything a type any. External page checkout is working, going to see if I can get the payment elements working doing this as well.
5 replies