加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-17 04:27:26 所属栏目:百科 来源:网络整理
导读:我的 ruby-on-rails应用程序使用条带进行卡支付. Stripe提供了一些webhooks,通过它可以联系我的应用程序,并提供有关每个事务的详细信息 – 成功或失败. 为此,我在我的控制器中有这样的事情: class StripeController ApplicationController def webhook data
我的 ruby-on-rails应用程序使用条带进行卡支付. Stripe提供了一些webhooks,通过它可以联系我的应用程序,并提供有关每个事务的详细信息 – 成功或失败.

为此,我在我的控制器中有这样的事情:

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读