[英]Stripe Authentication Error
I am running into an error with stripe payment processing with Rails 5. 我在Rails 5的条带付款处理中遇到错误。
Stripe::AuthenticationError (No API key provided. Set your API key using "Stripe.api_key = <API-KEY>".
This is my stripe.rb
file: 这是我的
stripe.rb
文件:
Rails.configuration.stripe = {
:publishable_key => ENV["stripe_public_key"],
:secret_key => ENV["stripe_api_key"]
}
Stripe.api_key = ENV["stripe_api_key”]
This is application.yml
(figaro): 这是
application.yml
(figaro):
stripe_api_key: xxx,
stripe_public_key: xxx
Running figaro heroku:set -e production
shows all the keys set right. 运行
figaro heroku:set -e production
显示所有正确设置的键。 Can you help me understand what needs to be corrected? 您能帮助我了解需要纠正的内容吗?
If Stripe's Ruby library reports that no API key was provided, that means that this line: 如果Stripe的Ruby库报告未提供任何API密钥,则表示此行:
Stripe.api_key = ENV["stripe_api_key"]
was either never executed at all, or that ENV["stripe_api_key"]
was nil
or an empty string. 根本没有执行过,或者
ENV["stripe_api_key"]
nil
或空字符串。
I'd recommend adding some traces in your code to figure out which is the case. 我建议在您的代码中添加一些痕迹,以找出是哪种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.