2017-10-21 5 views
1

Ruby 2.1.5を使用してRails 4.0.6アプリケーションでstripe gemとstripe_event gemを使用しています。 stripe_event gemのreadme(https://github.com/integrallis/stripe_event#authenticating-webhooks)の「webhookエンドポイントの保護」または「Webhooksの認証」セクションを試してみるまで、うまくいきました。両方の問題には同様の動作があるので、ここでは2番目の問題について説明します。Rails stripe_event gem issue:初期化されていない定数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

関連する問題