#morbe-webhook-invalidsignature

1 messages · Page 1 of 1 (latest)

stark dirgeBOT
#

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.

acoustic garden
#

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();```
keen jewel
acoustic garden
#

Hello yes, this is how my controller looks like

keen jewel
#

Can you please copy the code provided in the quickstart exactly and test it on your local machine?

stark dirgeBOT
#

morbe-webhook-invalidsignature

acoustic garden
#

        [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.

keen jewel
#

I'm going to guess this is Java?

acoustic garden
#

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?

keen jewel
#

Oh! Yeah the CLI prints out it's own webhook signature when it starts

#

It's right after you enter the command

acoustic garden
#

Ouhh! Thanks, I missesd it. Let me give this a try.

keen jewel
#

It's an easy thing to miss

acoustic garden
#

Thank you, that was it. Hah! Sorry for that silly mistake. Have a good night!