0

I have an app where i am trying to integrate stripe api. While following a certain tutorial i managed to configure my stripe keys as shown below.

In config/application.yml (figaro)

development:
  stripe_secret_key: sk_test_******************
  stripe_publishable_key: pk_test_******************

production:
  stripe_secret_key: sk_test_******************
  stripe_publishable_key: pk_test_******************

Then in config/initializers/stripe.rb i have

Rails.configuration.stripe = {
    :publishable_key => ENV['stripe_publishable_key'],
    :secret_key      => ENV['stripe_secret_key']
}

Stripe.api_key = Rails.configuration.stripe[:secret_key]

Everything works fine in development, however, when i deploy my app to heroku i get the error "You did not set a valid publishable key". Can someone advise, what is it i am doing wrong? I am still working with test mode.

  • The production or live key should starts with `pk_live_xxx` and `sk_live_xxxx`. probably that's the problem. – wsw Nov 22 '18 at 12:47
  • I have not yet tried with live stripe keys. I am using the test keys because i want to make sure i get it right before working in live mode or are you saying the test keys only work in development ? – Mkusa OneMoox Sakala Nov 22 '18 at 13:37
  • I see. Sorry my bad, what you could do is to print your key out before Stripe.api_key = Rails.configuration.stripe[:secret_key] making sure you are passing the correct environment settings/configurations. Looks like a configuration is not picked up – wsw Nov 23 '18 at 07:05

0 Answers0