I am trying to set up a Stripe payment form for a Rails 6 project, and I am not able to access my stripe secret keys. I am getting an error NoMethodError (undefined method `[]' for nil:NilClass)
What am I doing wrong?
Here's what I did
Edit my credentials.yml.enc - Type this in the console
EDITOR="code --wait" bin/rails credentials:edit
Added my secret keys to credentials.yml.enc
some_variable: secret_stuff development: stripe: stripe_public_key: fake_key strip_secret_key: fake_key
Closed the file and double checked it saved my code by opening up the file to verify it was saved (it was)
Open up rails console and typed in
Rails.application.credentials.some_variable
I expectedsecret_stuff
but I gotnil
.
Typed inRails.application.credentials.development[:stripe][:stripe_public_key].
I expectedfake_key
but I gotNoMethodError (undefined method `[]' for nil:NilClass)
WHAT AM I DOING WRONG?
I can't display a credit card form, and I just want to get this up and running so I can charge people and become a millionaire.