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

我的 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.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...