我正在开发一个使用stripe_event gem的Rails应用程序(4.2.x)。我在开发模式下处理webhook时遇到了困难。我正在使用ultrahook,而且我实际上正在参加活动,但是我得到的是:
Processing by StripeEvent::WebhookController#event as XML
Parameters: {.... pending_webhooks"=>2, "request"=>"req_73S67hYD35c8K9", "api_version"=>"2015-09-08"}}
Filter chain halted as #<Proc:0x007ffc73990350@/Users/mrl/.rvm/gems/ruby-2.2.2@.../app/controllers/stripe_event/webhook_controller.rb:3> rendered or redirected
Completed 401 Unauthorized in 7ms (ActiveRecord: 0.0ms)
stripe_event webhook_controller中的第3行是:
before_filter do
我的条带初始化程序如下:
Rails.configuration.stripe = {
publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
secret_key: ENV['STRIPE_SECRET_KEY'],
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
StripeEvent.authentication_secret = ENV['STRIPE_WEBHOOK_SECRET']
StripeEvent.configure do |events|
events.all do |event|
puts "\n\n\nStripe Event please: #{event}\n\n\n"
end
end
代码适用于我们的登台服务器:
Processing by StripeEvent::WebhookController#event as XML
I, [2015-09-26T10:20:18.909875 #28955] INFO -- : Parameters: {..... "request"=>nil, "api_version"=>"2015-09-08"}}
I, [2015-09-26T10:20:19.395064 #28955] INFO -- :
Stripe Event please: {
"id": "...""
"created": 1443262813,
"livemode": false,
"type": "balance.available",
"data": {"object":{"pending":[{"amount":5460,"currency":"usd"}],"available":[{"amount":29707,"currency":"usd"}],"livemode":false,"object":"balance"}},
"object": "event",
"pending_webhooks": 1,
"request": null,
"api_version": "2015-09-08"
}
我现在已经挣扎了好几天了,而且我很难过。有没有人任何想法,我可以解决这个问题?
答案 0 :(得分:0)
我猜这与开发模式中配置错误的环境变量有关,但很难说,因为当前版本的stripe_event
会掩盖WebhookController
中的基础异常。
但是,刚刚添加了一个提交来解决此问题并记录完整错误以帮助调试此类情况。请参阅Issue 56。