#kaveeshamuthukuda_webhooks

1 messages ¡ Page 1 of 1 (latest)

sullen helmBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1308361616047341570

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

muted tulip
#

hi there!

#

you need to create a real webhook endpoint in your Stripe dashboard.

finite geyser
#

Hi,I already did all that .It was working all fine in local enviornment .I want to know about hosting enviornment .I already have a webhook endpoint in stripe dashboard which works fine the logs are recorded fine.but I get 400 in stripe dashboard deliveries to webhook end points

muted tulip
#

can you share an event ID (evt_xxx) that retruned a 400 error?

finite geyser
#

evt_3QMnLYRvW6Yc17tk0hw3UgBk

#

when I run stripe listen --skip-verify in my powershell and do the transaction my backend gets hit .But practically I cant always run stripe listen Is there a permanent solution

muted tulip
#

but why are you using stripe listen? this should be only used for testing. now you should create a real webhook endpoint in your dashbaord that directly sends event to your server.

finite geyser
#

I already have a webhook endpoint [HttpPost]
[Route("webhook")]
public async Task<IActionResult> WebhookHandler()
{
var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
logger.LogInformation($"Webhook received: {json}");......... I get this issue in my dashboard Stripe exception: The expected signature was not found in the Stripe-Signature header. Make sure you're using the correct webhook secret (whsec) and confirm the incoming request came from Stripe..should I add webhook secret in front end?

muted tulip
#

did you update your webhook endpoint secret? the one used by the Stripe CLI is not the same one as the dashboard.

finite geyser
#

I think thats the issue can you please tell me where I can get the correct webhook endpoint secret for the hosted enviornment in dashboard

muted tulip
#

did you read the link I shared?

finite geyser
#

I got the secret from the dashboard thanks.EventUtility.ConstructEvent(requestBody, signature, endpointSecret); whats this approach . I have currently used this hope its fine var stripeSignature = Request.Headers["Stripe-Signature"].FirstOrDefault();

// Check if the Stripe-Signature header exists
if (string.IsNullOrEmpty(stripeSignature))
{
_logger.LogError("Stripe-Signature header is missing.");
return BadRequest("Stripe-Signature header is missing.");
}

// Construct the event using the Stripe webhook secret
var stripeEvent = EventUtility.ConstructEvent(json, stripeSignature, _webhookSecret);

muted tulip
#

you have to test your code to know if it works or not.

finite geyser
#

ok looks fine.I'll check most probably the issue is with the secret .Thanks !!

#

It works fine Thank you very much!!