REACT_APP_STRIPE_CUSTOMER_PORTAL in Saas template
hello,
how is REACT_APP_STRIPE_CUSTOMER_PORTAL defined in Saas template
import.meta.env.REACT_APP_STRIPE_CUSTOMER_PORTAL
3 Replies
Hi @altab. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
REACT_APP_STRIPE_CUSTOMER_PORTAL
is an environment variable that you can use in your Wasp project. In Wasp, you can use environment variables in both the client and the server code.
For client environment variables, they are embedded into the client code during the build and shipping process, making them public and readable by anyone. Therefore, you should never store secrets in them (such as secret API keys). To enable Wasp to pick them up, client environment variables must be prefixed with REACT_APP_
, for example: REACT_APP_SOME_VAR_NAME=...
.
You can read them from the client code like this:
In your case, you can access the REACT_APP_STRIPE_CUSTOMER_PORTAL
variable like this:
In production, you should provide them to the build command, for example:
What happens behind the scenes is that Wasp will replace all occurrences of import.meta.env.REACT_APP_SOME_VAR_NAME
with the value you provided. This is done during the build process, so the value is embedded into the client code.
For more details, you can refer to the Wasp documentation on environment variables (https://wasp-lang.dev/docs/project/env-vars).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @altab, 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?REACT_APP_STRIPE_CUSTOMER_PORTAL is a client side env variable so you have to put it in .env.client file
It's described here https://docs.opensaas.sh/guides/stripe-integration/#get-your-customer-portal-link
OpenSaaS.sh
Stripe Integration
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
thanks !
AHH I did not see the .client, I was looking in the .server !