All threads / Payments with Stripe Master Class

Ask A Question

Notifications

You鈥檙e not receiving notifications from this thread.

Payments with Stripe Master Class

Brian Gilbank asked in Rails

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] %>
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,399+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.