SubscriptionStatus and subscriptoinTier not getting updated in stripe test mode.

The subscription status and tier are not getting updated on default in stripe test mode. Is this expected behaviour? Will it work in the live mode, or does it have to be set up first?
5 Replies
kapa.ai
kapa.ai5mo ago
Hi @fred-123. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain information about Stripe integration with Wasp or handling of subscription status and tier in test or live mode. I recommend checking the official Wasp documentation or their GitHub issues for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, 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?
fred-123
fred-123OP5mo ago
Found the problem after reading the documentation again. Didn't have the stripe CLI running. Works just fine now. Just got confused as other services with stripe integration such as Gravity-Forms don't require the CLI part for testing. My bad. @kapa.ai I have another problem though. I have created a new subscription tier but when testing it it only updates subscriptionStatus for the new test user and leaves subscriptionTier empty: here is what i did: app/src/shared/constants.ts export enum TierIds { HOBBY = 'hobby', PRO = 'pro', PREMIUM = 'premium', //<--- Added Premium tier CREDITS = 'credits', } added tier description etc: app/src/client/app/PricingPage.tsx { name: 'New Tier name, id: TierIds.PREMIUM, price: '24,99 €', description: '', features: [''], }, added the new product in .env.server: PREMIUM_SUBSCRIPTION_PRICE_ID=price_andSoOn updated app/src/server/actions.ts let priceId; if (tier === TierIds.HOBBY) { priceId = process.env.HOBBY_SUBSCRIPTION_PRICE_ID!; } else if (tier === TierIds.PRO) { priceId = process.env.PRO_SUBSCRIPTION_PRICE_ID!; } else if (tier === TierIds.PREMIUM) { priceId = process.env.PREMIUM_SUBSCRIPTION_PRICE_ID!; } else if (tier === TierIds.CREDITS) { priceId = process.env.CREDITS_PRICE_ID!; } else { throw new HttpError(404, 'Invalid tier'); }
kapa.ai
kapa.ai5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the information provided, it seems like you have correctly added a new subscription tier in your Wasp application. However, the knowledge sources provided do not contain information about why the subscriptionTier is not getting updated for the new test user. Here are a few things you could check: 1. Ensure that the PREMIUM_SUBSCRIPTION_PRICE_ID in your .env.server file matches the ID of the new tier in your Stripe dashboard. 2. Check if there are any errors being thrown when you try to update the subscriptionTier. This could be happening in the part of your code where you update the subscriptionTier in your database after a successful Stripe transaction. 3. Make sure that the new tier is correctly set up in your Stripe dashboard and that it's available for subscriptions. If you're still having trouble, I recommend posting this issue on the Wasp Github repo (https://github.com/wasp-lang/wasp) or asking for help in the Wasp Discord community (https://discord.gg/rzdnErX). They might be able to provide more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, 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?
fred-123
fred-123OP5mo ago
figured it out. forgot to update the stripe.ts. adding this fixed it: } else if (line_items?.data[0]?.price?.id === process.env.PREMIUM_SUBSCRIPTION_PRICE_ID) { console.log('Premium subscription purchased'); await context.entities.User.updateMany({ where: { stripeId: userStripeId, }, data: { datePaid: new Date(), subscriptionTier: TierIds.PREMIUM,
}, });
Vinny (@Wasp)
Vinny (@Wasp)5mo ago
nice!
Want results from more Discord servers?
Add your server