0

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"
Zurch
  • 39
  • 10
  • If you copied/pasted this directly from your app, you might want to double check that the quotes you're using in `ENV[...]` are regular double quotes (`["..."]`), because in the code above, they look like Smart Quotes (`[“...”]`). – Eric Norcross May 10 '18 at 17:49
  • I changed all quoted references and some how I used smart quotes (where ever I got those .. copied from reference mtrl I guess) it works like a charm... thanks so much! – Zurch May 10 '18 at 17:57
  • well my server started great!! however I cant enter anything in the c/c field?? now what? – Zurch May 10 '18 at 18:16

0 Answers0