在localhost上一切正常,但是在heroku上我遇到了一些错误。
在Heroku上:
缺少卡片输入:
在localhost上
我相信是带有Api密钥的东西,但我不明白自己做错了什么:
config/initializers/stripe.rb :
Stripe.api_key = Rails.application.secrets.stripe_private_key
StripeEvent.signing_secret = Rails.application.secrets.stripe_webhook_secret
StripeEvent.configure do |config|
config.subscribe "charge." do |event|
Webhooks::Charge.new(event).call
end
end
secrets.yml:
development:
stripe_private_key: 'sk_test_*********'
stripe_public_key: 'pk_test_**********'
stripe_webhook_secret: 'whsec_**********'
在生产环境中,我使用了相同的测试键,因为我没有设置实时键
production:
stripe_private_key: 'sk_test_********'
stripe_public_key: 'pk_test_*********'
stripe_webhook_secret: 'whsec_*********'
谢谢您的时间。
更新:
我有很多,因为我尝试了很多事情。
答案 0 :(得分:0)
您的secrets.yml
文件在生产服务器上可能不存在。当然,它应该在您的.gitignore
中,但是您需要确保这些秘密也可以在Heroku上找到。
有关如何执行此操作的一些想法,请参见this answer。