Stripe and Convex HTTP Help
Im trying to setup my react app with convex and stripe. Currently im trying to use convex http route to handle stripe webhooks but its not working. i have stripe setup in my local host. And i modeled my code after this - https://www.convex.dev/templates/stripe but im still having problems.
So my code:
1. https://github.com/neura-labs-ai/web/blob/dev/website/convex/stripe.ts (Stripe convex functions)
2. https://github.com/neura-labs-ai/web/blob/dev/website/convex/payments.ts (Payment functions)
3. https://github.com/neura-labs-ai/web/blob/dev/website/convex/http.ts (Stipe http webhook handler)
3. https://github.com/neura-labs-ai/web/blob/dev/website/app/(console)/console/billing/page.tsx (Jsx to render and call the payment api)
heres the files used to run my code. So far all my code does is when the buttons are clicked for payment, it sends me to stripe. and after auth, i get the paymentId like normal but the webhook to validate if the user payment is complete does not run and im not sure why its not working...
10 Replies
Not a Stripe expert, but it looks like you need to add a
deployment-name.convex.site/stripe
to the "hosted endpoints" section
Remember Convex doesn't actually run locally on your machine, even in dev it's running and hosted on Convex servers.You'll find your dev deployment deployment name here
oh!
okay i think i understand
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
yes i found it, thank you so much
hey another question
Anyone know how I would listen for stripe event updates? Like when the user switches subscriptions or cancels a subscription?
There should be Stripe webhooks for this kind of thing
okay
And then you can use convex http actions to expose a url stripe can call: https://docs.convex.dev/functions/http-actions
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
See the demo project: https://github.com/get-convex/convex-stripe-demo/blob/main/convex/http.ts
GitHub
convex-stripe-demo/convex/http.ts at main · get-convex/convex-strip...
Demo showing integration between Convex and Stripe - get-convex/convex-stripe-demo
the demo was very helpful, its really the events https://github.com/get-convex/convex-stripe-demo/blob/main/convex/stripe.ts#L58 im trying to listen to from the stripe webhooks to check things like subscription cancels and other
GitHub
convex-stripe-demo/convex/stripe.ts at main · get-convex/convex-str...
Demo showing integration between Convex and Stripe - get-convex/convex-stripe-demo