I want to test stripe payment in development env
I am using wasp opensaas, now i messed around a bit with my env vars and forgot which are productoin and which env, i want to test my payment system on the development mode. What variables and things do i need to check and change to test it?
3 Replies
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 test Stripe payments in development mode with OpenSaaS, you need to set up the correct environment variables and follow the Stripe testing guidelines. Here's what you need to do:
Environment Variables Setup
For development, you should use
.env.server
and .env.client
files in the root of your project:
1. In .env.server
, you need to set up your Stripe test keys:
- STRIPE_SECRET_KEY
- Your Stripe test secret key
- STRIPE_WEBHOOK_SECRET
- Your Stripe webhook secret for testing
- SUBSCRIPTION_PRICE_ID
- The price ID for your test subscription product
2. In .env.client
, you can set any client-side variables with the REACT_APP_
prefix if needed.
Remember that in development, you can define environment variables using .env
files, which is the recommended method as mentioned in the Wasp documentation.
Stripe Testing Setup
To properly test Stripe payments in development:
1. Make sure you have the Stripe CLI installed and running to forward webhook events to your local server. This is crucial for testing the complete payment flow. Follow the instructions in the OpenSaaS Stripe testing guide.
2. Run the Stripe CLI with a command like:
3. Test specific webhook events using the Stripe CLI. For example, to test the invoice.paid
event:
Common Issues to Check
1. If you're getting a 401 error when trying to make a payment, check if your authentication is working correctly. There might be an email check that's causing issues if you're using username/password authentication in development as reported by other users.
2. Make sure your webhook is properly listening for the right events. If subscription status isn't updating, it might be because your webhook isn't catching the right events.
3. Check if you have Stripe Tax enabled. Some users have reported issues with tax settings. If you see an error about Stripe Tax not being activated, you might need to either:
- Enable it in your Stripe dashboard at https://dashboard.stripe.com/tax/setup
- Or set the tax flag to false in your code as mentioned by community members
Remember that OpenSaaS is a SaaS boilerplate template built with Wasp, so you're using Wasp under the hood but with the OpenSaaS template configuration.
Let me know if you encounter any specific errors during your testing!
----------------------
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?Hey @Sven just go into test mode on your stripe dashboard and get the keys from there to see which ones are your test keys
Yessssthc
Ai helped me good
Kapa