-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always get "The signature for the webhook is not present in the Stripe-Signature header" #1880
Comments
Hi @xqiu. Your code looks correct, and I've manually recomputed the signature to double-check that it's the correct one for that payload. I would recommend checking the following:
|
Thanks, ensuring triming the strings making my code work.
|
I tried that and I still get the error and I can verify that it does have all the steps you mentioned (endpoint secret starts with |
Did you try the code I show above with triming both json and header? It works for me. |
I actually figured this out; I was using the secret from the dashboard, but stripe cli gives you a temporary one. There was no need to do any of the triming |
This problem is unbelievable, well done @xqiu ! |
I am using stripe direct checkout for payment and configured webhook, getting "The signature for the webhook is not present in the Stripe-Signature header." error in the below code. string jsonOri = await new StreamReader(Request.Body).ReadToEndAsync();
I also upgraded the API version to the latest 2020-08-27. @xqiu Please look into this. |
@sonam2020 Please contact our support team for help instead: https://support.stripe.com/contact |
I wanted to share an experience I encountered, which might be helpful for others facing similar the issue. In my case, the issue was found to be related to the AWS CloudFront configuration. It appears that CloudFront was stripping off certain headers, including stripe-signature, before they reached our webhook endpoint. After diving into the CloudFront settings, we adjusted our configuration to explicitly include the stripe-signature header in the list of headers forwarded to the origin. |
How did you solve it on the cloudfront? |
Can confirm this works. Had to use Google translate to translate to English haha. Essentially in you need to edit your Cloudfront > Policies > Origin Request that deals with connections to your backend service. Now within the origin request policy hit edit and add NOTE: you can only do this if you have a custom policy. |
I'm using the test stripe to finish a checkout via webhook
The webook sends the following information to me
json:
stripe signature:
Stripe Webhook EndpointSecret I used for current test account:
But I still get Stripe exception: "The signature for the webhook is not present in the Stripe-Signature header."
I used asp.net core 2.2 to write the following code:
I wonder what's wrong with the code? I even went as far as debugging the signature comparing code in stripe.net , still don't see the issue. I failed in both dev machine (using CLI with its own secret), and in the cloud test server (using secret get from webhook).
Thanks!
The text was updated successfully, but these errors were encountered: