ruby on rails - Stripe "Invalid API Key Provided" -
i have followed stripe's rails tutorial (https://stripe.com/docs/checkout/guides/rails) (copy , pasted code), when run rails
publishable_key=pk_foo secret_key=sk_bar rails s
and go localhost:3000/charges/new , fill out fields test card data (card number "4242 4242 4242 4242"),
invalid api key provided: ***********_***
any ideas why happening?
you need plug in your publishable key , secret key; pk_foo
, sk_bar
placeholders. (unlike api docs, checkout tutorial doesn't use information account.)
you can them api keys tab of account.
i.e. secret key of sk123456 , publishable key of pk_987654, you'd issue:
publishable_key=pk_987654 secret_key=sk123456 rails s
if still doesn't work there couple things check:
- are both keys same environment (test or live)? people mix 2 together.
- if load rails console instead of rails server, can access environment variables
env['publishable_key']
,env['secret_key']
? - if you're using multiple apis, it's possible have kind of collision occurring; might try adjusting command-line , code stripe_publishable_key , stripe_secret_key.
Comments
Post a Comment