gpt4 book ai didi

ruby-on-rails - Stripe webhook 身份验证 - Ruby

转载 作者:数据小太阳 更新时间:2023-10-29 06:51:31 25 4
gpt4 key购买 nike

我的 ruby​​-on-rails 应用程序使用 stripe 进行卡支付。 Stripe 提供了 webhooks,通过它可以联系回我的应用程序并提供有关每个交易的详细信息 - 成功或失败。

为此,我在我的 Controller 中有这样的东西:

class StripeController < ApplicationController
def webhook
data_json = JSON.parse request.body.read
p data_json['data']['object']['customer']
end

我的问题是如何验证此 webhook 的真实性?据我所知和理解,可以很容易地模仿这一点(中间人攻击)。

最佳答案

来自 Stripe 的 webhooks documentation :

If security is a concern, or if it's important to confirm that Stripe sent the webhook, you should only use the ID sent in your webhook and should request the remaining details from the Stripe API directly.

关于ruby-on-rails - Stripe webhook 身份验证 - Ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21824307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com