简体   繁体   中英

JAVA: Stripe webhook error: No signatures found matching the expected signature for payload

I have been trying to set a webhook for the person.updated API from Stripe. I am trying a test webhook where I send a String in the method, like this:

    @ApiOperation(value = "Webhook controller")
    @PostMapping("/accountUpdate")
    public void handle(@RequestBody String event1, Response response, HttpServletRequest httpServletRequest){
}

and then in my Webhook.constructEvent , I am passing that String event1 as follows:

 try {
            event = Webhook.constructEvent(
                    event1, sigHeader, endpointSecret
            );
     }

But I am getting an error saying: No signatures found matching the expected signature for payload

I have tried to parse the String event1 (Which is the request body) into Json and it doesn't work. Passing the Request object instead of String didn't work either.

It seems like your end point Secret which you are providing in your code is incorrect or not matching to your person.update webhook's secret. End point secret goes like this.

"secret": "whsec_gaasdfkalkkklasew**********"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM