【发布时间】:2019-06-03 14:53:37
【问题描述】:
在 localhost 上一切正常,但在 heroku 上我遇到了一些错误。
在 Heroku 上:
卡输入丢失:
在本地主机上:
我认为是 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_*********'
感谢您的宝贵时间。
更新:
我有多个,因为我尝试了很多东西。
【问题讨论】:
标签: ruby-on-rails stripe-payments