W
Wasp-lang•6mo ago
jordi0lle

Stripe working in production but user credits don't update

Hi guys, Today I tried to make a payment on my SaaS https://www.fueltrackerapp.com and everything worked fine except for one thing, the user credits didn't update! I'm not so sure what's happening because in dev mode everything works fine. Anybody knows what could be happening?
Fuel Tracker App
Fuel Tracker App
Track any vehicle fuel
36 Replies
kapa.ai
kapa.ai•6mo ago
Hi @jordi0lle. 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. However, based on the knowledge sources, it seems like other users have experienced similar issues with Stripe and user credits not updating. Here are a few things you could check: 1. Make sure you're running the Stripe CLI and that you're receiving events to the webhook. You can check this in the Stripe testing section of the open SaaS docs. 2. Check if you're importing the correct action on the client. For example, you should be importing stripeCreditsPayment. 3. Try to debug by adding console.log lines in your code to see where the issue might be occurring. 4. Ensure that your Stripe product configuration is correct. You should have a one-time payment product set up for buying credits. 5. Check if there's a difference between your development and production environments that could be causing the issue. If you're still having trouble, it might be helpful to look at the Wasp Discord (https://discord.com/channels/686873244791210014) for more specific advice or to ask the community for help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @jordi0lle, 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?
miho
miho•6mo ago
@Vinny (@Wasp) please take a look 🙃
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
It’s working in dev but not prod — this sounds like some env variables or configuration got messed up along the way. Is the webhook configured correctly for prod? Did you create a product for a credits payment just as you did when testing (but not in stripe test mode obviously)? Also can you check your stripe dashboard and under webhooks look for the webhook event that was sent by stripe when the payment was made?
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Stripe Login | Sign in to the Stripe Dashboard
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Successful events will look like this
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
No description
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
If the event isn’t even being sent, then you didn’t configure your webhook to listen for it
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
No description
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
@jordi0lle
jordi0lle
jordi0lleOP•6mo ago
I'll try this later today because I just checked and I only have it set in test mode. I'll inform here if the problem is solved after checking it 😄 THX @Vinny (@Wasp) Hi @Vinny (@Wasp), I changed added the correct key and the 4 events used for purchasing credits and now I'm not so sure how to solve this:
jordi0lle
jordi0lleOP•6mo ago
No description
jordi0lle
jordi0lleOP•6mo ago
Any idea?
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Hmm. If it was working in development than there is some configuration step that you’re missing in production. Did you get the production webhook signing secret? Is the webhook on stripe pointing to the correct url? Are other aspects of your app working? If not maybe you forgot an env variable somewhere else
jordi0lle
jordi0lleOP•6mo ago
I got the weebhook signing secret from here
jordi0lle
jordi0lleOP•6mo ago
No description
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
You deployed to fly.io I guess? Can you run wasp deploy fly cmd secrets list --context server and check that all your necessary en vats are set (https://docs.opensaas.sh/guides/deploying/)?
jordi0lle
jordi0lleOP•6mo ago
I deployed on railway And I checked that the keys I placed from stripe were all correct All these keys in red match Stripe correctly for "production" mode
jordi0lle
jordi0lleOP•6mo ago
No description
jordi0lle
jordi0lleOP•6mo ago
Changed the webhook this morning as you were right yesterday (the one I was using was the test key) and now it's correct as you can see
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
What could be different between your development environment and production? Can you check your server logs and see if any events were coming through at all?
jordi0lle
jordi0lleOP•6mo ago
No description
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Yeah so the stripe redirect is working but the webhook events aren’t being captured. Did you redeploy/restart the server since updating the env vars?
jordi0lle
jordi0lleOP•6mo ago
I did redeploy straight from railway Is that okay or should I build the app again and deploy it from my computer?
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
This should be ok. All I can think of at the moment is to double check your endpoint url and all the configuration settings. Go back and look at your development set up and try to find what’s different between that and your production setup @jordi0lle can you share the webhook definition in your wasp file as well as your webhook URL you’ve entered in the stripe dashboard (don’t worry you can share this publicly)?
jordi0lle
jordi0lleOP•6mo ago
You mean this?
No description
jordi0lle
jordi0lleOP•6mo ago
And this
No description
jordi0lle
jordi0lleOP•6mo ago
Is what you mean? @Vinny (@Wasp)
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
You need to add /stripe-webhook to the end of your URL There’s the problem
jordi0lle
jordi0lleOP•6mo ago
so should be https://server-production-153a.up.railway.app/stripe-webhook??
MEE6
MEE6•6mo ago
Wohooo @jordi0lle, you just became a Waspeteer level 5!
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Yep
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
OpenSaaS.sh
Deploying
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
jordi0lle
jordi0lleOP•6mo ago
Nice! This and the key where the only thing missing 🙃 Thanks a lot for your help!
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
Awesome! Glad you got it working now
miho
miho•6mo ago
Nice good job guys 🤗
Want results from more Discord servers?
Add your server