JAVA:Stripe Webhook 错误:未找到与有效负载的预期签名匹配的签名

标签 java stripe-payments

我一直在尝试为 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/

相关文章:

java - 为什么 eclipse 或 cmd 控制台会缓存操作系统环境变量?

Java.lang.OutOfMemoryError :Java heap space org. apache.poi.ss.formula.FormulaCellCacheEntrySet.add(FormulaCellCacheEntrySet.java:63)

javascript - Stripe API 错误 - 缺少必需的参数 : amount - PHP library

javascript - strip 化 IBAN 元素错误 'The type ` sepa_debit` 不是有效的源类型。

jquery - 如何修改 Stripe Checkout 以改为发送 AJAX 请求?

javascript - React js Stripe结帐不起作用

java - 在 maven 中创建并安装 de-lomboked 源 jar

Java Applet 无法清除屏幕上的文本

java - 无法收听 .wav 音频文件?

stripe-payments - 以编程方式注册 stripe webhooks