W
Wasp5mo ago
Hastur

Issue with Stripe webhook testing using CLI

Hi, I am trying to test payment intent in local using Stripe CLI. I have followed both pages from the doc (Stripe Integration and Stripe Testing). But, when I am testing using the following command: stripe trigger payment_intent.succeeded --api-version 2022-11-15 I have this in the other terminal listening for the webhook: 2024-07-28 15:09:09 --> charge.succeeded [evt_3PhWqWCWXwZlQqXs0YgFiPrS] 2024-07-28 15:09:09 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqWCWXwZlQqXs0YgFiPrS] 2024-07-28 15:09:09 --> payment_intent.succeeded [evt_3PhWqWCWXwZlQqXs094ZSBa6] 2024-07-28 15:09:09 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqWCWXwZlQqXs094ZSBa6] 2024-07-28 15:09:09 --> payment_intent.created [evt_3PhWqWCWXwZlQqXs0REC6Omq] 2024-07-28 15:09:09 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqWCWXwZlQqXs0REC6Omq] 2024-07-28 15:09:24 --> charge.succeeded [evt_3PhWqmCWXwZlQqXs17CkZkYq] 2024-07-28 15:09:24 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqmCWXwZlQqXs17CkZkYq] 2024-07-28 15:09:25 --> payment_intent.succeeded [evt_3PhWqmCWXwZlQqXs1xjv7iER] 2024-07-28 15:09:25 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqmCWXwZlQqXs1xjv7iER] 2024-07-28 15:09:25 --> payment_intent.created [evt_3PhWqmCWXwZlQqXs15SSlCsC] 2024-07-28 15:09:25 <-- [404] POST http://localhost:3000/stripe-webhook [evt_3PhWqmCWXwZlQqXs15SSlCsC] The API version is matching the one in @src/payment/stripe/stripeClients.ts, the port is the good one (the one running the app) and the path to the webhook is the one defined in the wasp config file with httpRoute: (POST, "/stripe-webhook"). I don't understand what could go wrong. But, when I go to dashboard.stripe.com/test/logs, I can see my requests listed as: POST /v1/payment_intents 200 OK API Version 2022-11-15 So maybe it worked but the CLI is giving me an error? I guess the dashboard logs page is more thrustworthy?
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @Hastur. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided, it seems like you have set up the Stripe CLI correctly and are triggering the right events. The 404 error you're seeing in the terminal suggests that the webhook endpoint at <http://localhost:3000/stripe-webhook> is not found. Here are a few things you could check: 1. Ensure that your Wasp server is running and listening on the correct port (3000 in your case). 2. Verify that the httpRoute: (POST, "/stripe-webhook") is correctly defined in your Wasp configuration file. 3. Make sure that the Stripe webhook endpoint is correctly set up in your Wasp application. If you see the requests listed as 200 OK in your Stripe dashboard logs, it indicates that the requests to create payment intents are successful. However, the 404 errors from the CLI suggest that the webhook events are not being received by your application. Unfortunately, the knowledge sources provided do not contain specific information on how to debug this issue in Wasp. I would recommend checking the official Wasp documentation or reaching out to the Wasp community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Hastur, 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?
Hastur
HasturOP5mo ago
Ok so I had a bug in my VSCode in the Port tabs, it displayed 3000 and 3001 and both running processes were server.js So, restarting the whole thing and using stripe trigger payment_intent.succeeded --api-version 2022-11-15 via the port 3001 worked.
Want results from more Discord servers?
Add your server