I created a form for a rails 5 project for users to save there c/c on stripe for future pmts. I had it working successfully (successful code without implementing figaro below) prior to hiding keys using figaro. Now the server will not start error below. Iv only used figaro on a couple occasions so I am having troubles implementing on this particular form. I feel i'm so close have I missed a step? Thanks for assessing.
Error from console:
config/initializers/stripe.rb:2:in <top (required)>': undefined local variable or method
“STRIPE_PUBLISHABLE_KEY”' for main:Object (NameError)
Successful code portion prior to figaro:
var stripe = Stripe('<%= Rails.configuration.stripe[:publishable_key] %>');
code implementing figaro:
Payment.html.erb (portion that changed from successful code above )
<script>
$(function() {
var stripe = Stripe('<%= Rails.configuration.stripe[:ENV[“STRIPE_PUBLISHABLE_KEY”]] %>');
var elements = stripe.elements();
Stripe.rb folder
Rails.configuration.stripe = {
:publishable_key => ENV[“STRIPE_PUBLISHABLE_KEY”],
:secret_key => ENV[“STRIPE_SECRET_KEY”]
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
Application.yml(secrets changed)
STRIPE_SECRET_KEY: "sk_test_UW12345678910t"
STRIPE_PUBLISHABLE_KEY: "pk_test_Fv1234567890p"