微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

原文地址:https://www.jb51.cc/ruby/268977.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐