W
Wasp7d ago
Dada

STRIPE PLAN ID is sent to checkout request as Price

guys i created 3 products in Stripe test , and set my 3 env variables : PAYMENTS_HOBBY_SUBSCRIPTION_PLANID=prod...., PAYMENTS_PRO_SUBSCRIPTION_PLANID=prod..., PAYMENTS_CREDITS_10_PLANID=prod... when i tried to subscribe in my app : the request payload in the line_items object the price was set to the plan id . am i doing something wrong ?
4 Replies
kapa.ai
kapa.ai7d ago
Hi @Dada. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It looks like you're encountering an issue with your Stripe integration in Wasp's OpenSaaS template. The problem is that you're using product IDs (prod...) in your environment variables, but Stripe checkout requires price IDs (price...) instead. Based on the knowledge sources, the environment variables should be using price IDs, not product IDs. In Stripe, a product can have multiple prices associated with it, and when creating a checkout session, you need to specify which price you want to use. For example, in the OpenSaaS template, the environment variables should look like:
HOBBY_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycMvx4PzB0N
PRO_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycM4IAAGRcT
HOBBY_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycMvx4PzB0N
PRO_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycM4IAAGRcT
As seen in one of the support threads, the checkout session creation uses these price IDs directly:
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
// ...other options
});
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
// ...other options
});
To fix your issue: 1. Go to your Stripe dashboard 2. Find the prices associated with your products 3. Use the price IDs (starting with "price_") in your environment variables instead of product IDs This should resolve the issue with your checkout requests. Stripe Testing Guide might also be helpful for setting up and debugging your Stripe integration. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Dada, 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?
toticozeni
toticozeni6d ago
@Dada hello, did you perhaps fix your issue?
Dada
DadaOP6d ago
@franjo Thank you bro, i switched to lemonsquizy and it works fine.
toticozeni
toticozeni6d ago
Great, glad to see it's working

Did you find this page helpful?