Skip to main content

Payments with Stripe Master Class

Rails • Asked by Brian Gilbank

Hey Chris - I signed up for your payments with Stripe course and "Creating The Checkout Form With Stripe.js" section is really confusing. Basically video three on the New Stripe JS element does everything the followng three videos do, but the codiing is a little different?

Can I just use the content from video three?

Brian


Yep, like I mentioned in the course, the new Stripe Elements code is the newest version of the Stripe Javascript. The old code is there for reference, but you can just use the Stripe Elements version and you will be all set. 👍

Let me know if you run into any troubles!


Thanks for the quick response Chris. I will defintely let you know if I have have any follow up questions.

On an unrelated note, I am using the Windows Subsystem for Linux with PostgreSQL installed on the Windows side. This means I can't access the Heroku database by running heroku psql in bash. Do you know of any work around for this?

The local psql command could not be located. For help installing psql, see https://devcenter.heroku.com/articles/heroku-postgresql#local-setup

Thanks,
Brian


I would probably just install the Heroku CLI on Windows as well to solve that problem. Then you can access that from Windows until it's finally stable to run on the Linux subsystem.


Hi Chris - Quick update, I am just getting back to this course and I've updated my Rails app to 5.2.

I am on the "New Stripe Elements Video" and trying to call my credentials from the application file.

Therefore, I am just wondering how to correctly call my credentials from config/credentials.yml.enc. Currently I have:

<%= tag :meta, name: "stripe_key", content: Rails.application.credentials.development[:stripe_publishable_key] %>

This is working but should I do an if else statement for production vs development?

This is the content of the my credentials file:

development:
stripe_publishible_key:
stripe_secret_key:

production:
stripe_publishible_key:
stripe_secret_key:


Hey Brian!

I would just use Rails.env in your line there to make it dynamic. Should be something like this:

<%= tag :meta, name: "stripe_key", content: Rails.application.credentials[Rails.env][:stripe_publishable_key] %>

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.