简体   繁体   English

条带验证错误

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM