W
Wasp2y ago
lazi

[SOLVED]Monthly unlimited subscription not working

Hello again! I've set-up Stripe along with a test subscription to try out. The button from account and payment works well but my account state doesn't seem to be updating properly. Even after the subscription showed success my credits stayed at 0 in the account page and the GPT generator is not working due to insufficient credits. What can I do to fix it ?
No description
No description
No description
No description
17 Replies
lazi
laziOP2y ago
Also, what is it needed to set-up the buy credits button too? It seems to be deactivated and only the subscription works.
No description
Vinny (@Wasp)
Vinny (@Wasp)2y ago
hm. we would need to see your code. Can you share a github repo? It's probably an issue in the webhook.ts file as for the "buy credits" functionality, that is simply disabled in the css of the component. You have to set it up yourself by creating a new product on Stripe
lazi
laziOP2y ago
yeah sure thing, one second
lazi
laziOP2y ago
Well I seem to be having some problems with my setup and git atm so until a bit later: https://pastebin.com/E4wvM6tJ
Pastebin
import { StripeWebhook } from '@wasp/apis/types';import { emailSend...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Vinny (@Wasp)
Vinny (@Wasp)2y ago
maybe try removing lines 28-36 did you make any changes to the webhook.ts file?
lazi
laziOP2y ago
nope, just looked through it trying to figure out the Stripe events i'm supposed to set-up for the webhook (where I ended up putting them all) trying this rn Didn't work
lazi
laziOP2y ago
No description
MEE6
MEE62y ago
Wohooo @lazi, you just became a Waspeteer level 4!
Vinny (@Wasp)
Vinny (@Wasp)2y ago
hmm. I'd suggest checking your stripe webhook dashboard and see if the events are being sent out correctly e.g. is it sending out events to the correct URL for your deployed server and that it's the correct product ID as well
lazi
laziOP2y ago
They all seem to be going through fine
No description
lazi
laziOP2y ago
Pastebin
payment_intent.succeededResendMore optionsResponse200 OK
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lazi
laziOP2y ago
and for the customer subscription update: https://pastebin.com/UKTtg0D1
Pastebin
customer.subscription.updated - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lazi
laziOP2y ago
Is there any guide on how to set Stripe webhook? I still cannot figure the problem here but my best guess is also wrong setup
Vinny (@Wasp)
Vinny (@Wasp)2y ago
If you can share the github repo with me, I can take a look this week
lazi
laziOP2y ago
Thank you! To be fair i didn't modify much from the template itself, just some translations. In the meanwhile @hometechdad gave me some more tips and is now working properly ❤️ My problem was setting the Stripe webhook URL wrong - I was setting it to client instead of server. So the error was on my Stripe set-up, not in the code. So for all the new ones trying - make sure that the URL is set to server and with /stripe-webhook at the end
martinsos
martinsos2y ago
@Vinny (@Wasp) do you think there is a place in docs or in template where can emphasize this, in order to help people avoid this mistake in the future?
Vinny (@Wasp)
Vinny (@Wasp)2y ago
noted

Did you find this page helpful?