W
Wasp-lang7mo ago
Arnab

stripe issues

Hi I'm following the instructions and trying to get the customer portal link activated. "Note that there are variables set aside for your test portal link, as well as a production portal link. You will be warned in the console if you there is no link in the development environment, but the app will throw an error if there is no link in the production environment!" Please help me understand exactly what I need to have in the constant.ts file to launch
9 Replies
kapa.ai
kapa.ai7mo ago
Hi @Arnab. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The constants.ts file is where you should paste your Stripe Customer Portal link. This file is located in the src/shared directory of your project. If you can't find this file, you may need to create it. Here's an example of what the constants.ts file might look like:
import { z } from 'zod'

export const STRIPE_CUSTOMER_PORTAL_LINK = z.string().parse(process.env.STRIPE_CUSTOMER_PORTAL_LINK!)
import { z } from 'zod'

export const STRIPE_CUSTOMER_PORTAL_LINK = z.string().parse(process.env.STRIPE_CUSTOMER_PORTAL_LINK!)
In this file, STRIPE_CUSTOMER_PORTAL_LINK is an environment variable that should contain the link to your Stripe Customer Portal. You need to set this environment variable in your .env file. Your .env file might look something like this:
STRIPE_CUSTOMER_PORTAL_LINK=your_stripe_customer_portal_link_here
STRIPE_CUSTOMER_PORTAL_LINK=your_stripe_customer_portal_link_here
Replace your_stripe_customer_portal_link_here with the actual link to your Stripe Customer Portal. Remember, environment variables allow your project to exhibit different behaviors in different environments, such as development, staging, or production. For instance, in development, you may want to use a test Stripe account, while in production, your app should use a real Stripe account. You can read more about environment variables in Wasp here (https://wasp-lang.dev/docs/project/env-vars). If you're still having trouble, please provide more details about the issues you're encountering so I can provide more targeted assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Arnab, 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?
Arnab
ArnabOP7mo ago
In VScode I'm also getting errors in isDev and checkStripePortalLinkExists
MEE6
MEE67mo ago
Wohooo @Arnab, you just became a Waspeteer level 1!
Arnab
ArnabOP7mo ago
checking in I'm still getting error in VScode in my constants.ts. Please help" const customerPortalTestUrl = undefined const customerPortalProdUrl = 'https://billing.stripe.com/p/login/hiddeennnnn' export const STRIPE_CUSTOMER_PORTAL_LINK = isDev ? customerPortalTestUrl : customerPortalProdUrl; checkStripePortalLinkExists(STRIPE_CUSTOMER_PORTAL_LINK); // throws an error if the link is not set in production export enum TierIds { HOBBY = 'hobby-tier', PRO = 'pro-tier', CREDITS = 'credits', } export const DOCS_URL = 'https://docs.opensaas.sh'; export const BLOG_URL = 'https://docs.opensaas.sh/blog';"
Filip
Filip7mo ago
Hi @Arnab, just to be clear, you're talking about OpenSaas?
martinsos
martinsos7mo ago
@Arnab please chekc out this issue -> does this solve your problem? https://github.com/wasp-lang/open-saas/issues/119
GitHub
checkStripePortalLinkExists throws an error · Issue #119 · wasp-lan...
The documentation (https://docs.opensaas.sh/guides/stripe-integration/) says to add this code to the src/shared/constants.ts file: const customerPortalTestUrl = 'https//billing.stripe.com/p/log...
Arnab
ArnabOP7mo ago
fixed it thank you! Where is the logic for credits? I'm trying to understand how to for example deduct credits for uploading and image.
miho
miho7mo ago
@Vinny (@Wasp) one for you
Want results from more Discord servers?
Add your server