我一直在尝试为 Stripe 的 person.updated
API 设置 Webhook。我正在尝试一个测试 webhook,在方法中发送一个字符串,如下所示:
@ApiOperation(value = "Webhook controller")
@PostMapping("/accountUpdate")
public void handle(@RequestBody String event1, Response response, HttpServletRequest httpServletRequest){
}
然后在我的 Webhook.constructEvent
中,我按如下方式传递 String event1:
try {
event = Webhook.constructEvent(
event1, sigHeader, endpointSecret
);
}
但我收到一条错误消息:未找到与有效负载的预期签名匹配的签名
我尝试将 String event1 (这是请求正文)解析为 Json,但它不起作用。传递 Request 对象而不是 String 也不起作用。
最佳答案
您在代码中提供的端点 Secret 似乎不正确或与您的 person.update webhook 的 secret 不匹配。端点 secret 是这样的。
“ secret ”:“whsec_gaasdfkalkkklasew************”
关于JAVA:Stripe Webhook 错误:未找到与有效负载的预期签名匹配的签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59243486/