#morbe-webhook-invalidsignature
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- resmurf, 1 day ago, 19 messages
- morbe-connect-directcharges, 1 day ago, 27 messages
I do get a signature
var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
var stripeWebhookSecret = _configuration["STRIPE_WEBHOOK_SECRET"];
var stripeSignatureHeader = Request.Headers["Stripe-Signature"];
var stripeEvent = EventUtility.ConstructEvent(json, stripeSignatureHeader, stripeWebhookSecret);
if(stripeEvent == null) return BadRequest();```
Hi 👋
Are you using one of our libraries? Can you verify that the code we provide here works?
https://docs.stripe.com/webhooks/quickstart
Hello yes, this is how my controller looks like
Can you please copy the code provided in the quickstart exactly and test it on your local machine?
morbe-webhook-invalidsignature
[AllowAnonymous]
[HttpPost("/payments/webhook")]
public async Task<IActionResult> webhook()
{
var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
var stripeWebhookSecret = _configuration["STRIPE_WEBHOOK_SECRET"];
var stripeSignatureHeader = Request.Headers["Stripe-Signature"];
var stripeEvent = EventUtility.ConstructEvent(json, stripeSignatureHeader, stripeWebhookSecret);
if(stripeEvent == null) return BadRequest();
if (stripeEvent.Type == Events.PaymentIntentSucceeded)
{
PaymentIntent paymentIntent = (PaymentIntent)stripeEvent.Data.Object;
var vehicle = await _vehicleService.GetParkedCar(paymentIntent.Metadata["vehicleId"], true);
if (vehicle == null) return Ok();
return Ok();
}
if (stripeEvent.Type == Events.PaymentIntentPaymentFailed) return Ok();
if (stripeEvent.Type == Events.PaymentIntentCreated) return Ok();
if (stripeEvent.Type == Events.PaymentIntentProcessing) return Ok();
if (stripeEvent.Type == Events.PaymentIntentAmountCapturableUpdated) return Ok();
return Ok();
}
I'm currently using stripe CLIin localhost.
I'm going to guess this is Java?
C#
I'm guessing because thisstripe signature is for my url; and i'm using it in localhost?
What would be my CLI's signature?
Oh! Yeah the CLI prints out it's own webhook signature when it starts
It's right after you enter the command
Ouhh! Thanks, I missesd it. Let me give this a try.
It's an easy thing to miss
Thank you, that was it. Hah! Sorry for that silly mistake. Have a good night!