#cajazzer_best-practices
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- cajazzer_subscription-pricechange, 27 minutes ago, 5 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1252679182077394956
đ Have more to share? Add details, code, screenshots, videos, etc. below.
Hello! Stripe's terms of service do not allow for testing in live mode. As such, we can't provide guidance for testing in live mode.
I actually want to test in "test mode" but using our website (not localhost with stripe listen).
Ah, I see. You would need to set up an actual Webhook Endpoint in test mode in that case.
Or you can do it via the Dashboard.
I have done that. It keeps failing with a 400 Bad Request.
Sorry Invalid request
Can you give me the request ID so I can take a look? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Is this it: evt_1PSp4rC4T1iPI2rAF8sYB6Xc
That's an Event ID, not a request ID. Request IDs start with req_.
I'm looking for the request ID showing the 400 invalid request error you mentioned.
Hold on, seeing the error in the webhooks log but not the general logs section
To clarify, are you seeing that error when attempting to create the Webhook Endpoint itself, or have you already done that and you're seeing 400 responses from your own server when we attempt to send an Event to it?
I am verifying that in my server code an error is coming from: event = stripe.webhooks.constructEvent(body, signature, SECRET_STRIPE_WEBHOOK_KEY)
I thought you were talking about the former, but now it sounds like you're talking about the latter?
Sorry, the later yes.
I do see 400 responses from your server on evt_1PSp4rC4T1iPI2rAF8sYB6Xc. Those are coming from your code and are something you need to fix on your end.
My code worked using localhost and stripe listen. Just trying to figure out the delta on our real server. I assume the test keys should still work.
What does "test keys" refer to? If you're talking about the webhook signing secret, it's going to be different for an actual Webhook Endpoint vs. the one the CLI provides.
Ah! I bet that is it.
Did that get it working for you?
No, I used the signing secret for the webhookj endpoint in test mode but it did not work.
Same error or different?
same error: Webhook signature verification failed. No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
Usually that error is caused by using the wrong webhook secret or by not passing the raw, unaltered body.
You need to pass the exact raw body you get in the request. It can't be parsed or changed in any way. Even whitespace changes will cause verification to fail.
I was following the example foound here: https://www.sveltestripe.com/#webhooks
I doubt const body = await request.text() is going to give you the raw, unaltered body. It might... but I'm dubious.
When using Node it's often hard to get the raw body, and there's no one solution that always works. Generally you want to extract the raw body first thing, before any middleware or other logic. There's a long thread of possible solutions/approaches you can try here: https://github.com/stripe/stripe-node/issues/341
Thanks. I will take a look at the docs. Thanks for the help.
No problem, good luck with it!