2017-10-21 42 views
1

我在使用Ruby 2.1.5的Rails 4.0.6应用程序中使用stripe gem和stripe_event gem。直到我尝试了stripe_event gem自述文件(https://github.com/integrallis/stripe_event#authenticating-webhooks)的'保护webhook端点'或'身份验证webhooks'部分时,它一直运行良好。看起来这两个问题都有类似的行为,所以我只在这里描述第二个问题。Rails stripe_event gem问题:未初始化的常量Stripe :: SignatureVerificationError

当我尝试使用下面的代码验证我的webhook(在尝试此操作之前工作正常),我得到一个未初始化的常量错误。

#config/initializers/stripe.rb 

Rails.configuration.stripe = { 
    :publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'], 
    :secret_key  => ENV['STRIPE_SECRET_KEY'] 
} 

Stripe.api_key = Rails.configuration.stripe[:secret_key] 

#this is the line that supposedly tells stripe_event to verify the stripe signature  
StripeEvent.signing_secret = ENV['STRIPE_SIGNING_SECRET'] 

StripeEvent.configure do |events| 
    events.all do |event| 
    if event.type == 'invoice.payment_failed' 
     #handled this event...removed code for clarity since works fine 
    end 
    end 
end 

这是错误:

NameError stripe_event/webhook#event 
uninitialized constant Stripe::SignatureVerificationError 

我从我的条纹仪表板的条纹签名密钥如条纹文档描述:描述https://stripe.com/docs/webhooks#signatures

我一直在测试触发事件在条纹文档中:https://stripe.com/docs/recipes/sending-emails-for-failed-payments#testing

对此的任何帮助将不胜感激。

回答

1

尝试更新您的条纹宝石。它将开始工作。

+0

这样做的伎俩!鉴于错误信息,后知后觉 – user3754940

相关问题