W
Wasp3mo ago
Sven

How do i implement the stripe webhook in production

in the guide it tells how to implement stripe webhook in development, but how do i get this for production, opensaas.
1 Reply
kapa.ai
kapa.ai3mo ago
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To implement the Stripe webhook in production, you need to update the webhook logic in your Wasp application. Here are the steps you can follow: 1. In your Stripe Dashboard, set the webhook endpoint to your server domain. It should look something like {your-fly-server-domain}/stripe-webhook. 2. Once you deploy your application to a platform like Fly.io, you need to change the webhook secret in the Stripe -> Dev -> Webhooks section. 3. Create a new webhook by URL pointing to your server url/stripe-webhook endpoint. 4. Add the Webhook Secret found on the stripe dashboard to your .env settings. Remember, the Stripe CLI that the Open-Saas Docs reference is for local development. When you move to production, you need to update the webhook secret and point it to your production server. For more details, you can refer to the OpenSaaS guide (https://docs.opensaas.sh/guides/deploying/#setting-up-your-stripe-webhook) on setting up the Stripe webhook in production. Please note that you should never store secrets in client environment variables as they are publicly readable. You can store secret values in server environment variables as they are not publicly readable. You can read more about this in the Wasp documentation on environment variables (https://wasp-lang.dev/docs/project/env-vars). Here is an example of how you can define and use environment variables in Wasp:
// Define environment variable
SOME_VAR_NAME=...

// Use environment variable in server code
console.log(process.env.SOME_VAR_NAME)
// Define environment variable
SOME_VAR_NAME=...

// Use environment variable in server code
console.log(process.env.SOME_VAR_NAME)
I hope this helps! Let me know if you have any other questions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, 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?
Want results from more Discord servers?
Add your server