W
Wasp3mo ago
p4j4r5

Opensaas

I don't see Price ID in Sass, but just the product ID. Are they same?
3 Replies
kapa.ai
kapa.ai3mo ago
Hi @p4j4r5. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In the context of Stripe integration with OpenSaaS, a product ID and a price ID are not the same. When you create a product in Stripe, you can assign it a price. This price has its own unique ID, separate from the product ID. In the OpenSaaS code, you can see an example where a price ID is used to create a Stripe checkout session. Here's the relevant code snippet:
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
success_url: `${DOMAIN}/checkout?success=true`,
cancel_url: `${DOMAIN}/checkout?canceled=true`,
automatic_tax: { enabled: true },
customer_update: {
address: 'auto',
},
customer: customer.id,
});
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
success_url: `${DOMAIN}/checkout?success=true`,
cancel_url: `${DOMAIN}/checkout?canceled=true`,
automatic_tax: { enabled: true },
customer_update: {
address: 'auto',
},
customer: customer.id,
});
In this code, process.env.SUBSCRIPTION_PRICE_ID! is used to specify the price ID for the product being purchased. This ID is expected to be stored in the environment variables of your application. For more information on how to use Stripe with OpenSaaS, you can refer to the Stripe testing guide (https://docs.opensaas.sh/guides/stripe-testing/) mentioned in the knowledge sources. Source: Discord support thread: stripe integration debugging best practices > Answers (https://discord.com/channels/686873244791210014/1200182362449907813) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @p4j4r5, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Filip
Filip3mo ago
Hey @p4j4r5, can you elaborate some more? What's price ID (where does that terminology come from)? What do you mean by "see", where do you see it? What would you expect to see?
p4j4r5
p4j4r5OP3mo ago
Figured it out. The UI on stripe has changed. We need to click on each of the product and then it displays price and clicking three dots there is option to copy Price ID.
Want results from more Discord servers?
Add your server