#Atish

1 messages · Page 1 of 1 (latest)

zenith ruinBOT
violet hull
#

Hello! What's the specific error message in the exception?

cerulean brook
#

No signatures found matching the expected signature for payload

#
@PostMapping("/webhooks")
    fun webhook(@RequestBody event: Event, request: HttpServletRequest): ResponseEntity<String> {
        Stripe.apiKey = stripeApiKey
        val sigHeader = request.getHeader("Stripe-Signature")
        try {
            val eventString = event.toJson()
            Webhook.constructEvent(eventString, sigHeader, stripeWebhookEndpointSecret)
        } catch (ex: SignatureVerificationException) {
            return ResponseEntity.badRequest().body("")
        }
        stripeService.handleEvent(event)
        return ResponseEntity.ok("")
    }
#

Right now I am testing in localhost using the stripe cli

violet hull
#

That usually means you're using the wrong whsec_ value or you're not using the raw body of the incoming request. I think the latter is your main problem. You should not be doing event.toJson(). That will transform the body. You should be passing the raw request body to constructEvent.

cerulean brook
#

Thank you so much