Keeping it simple
Thomas Ochman
265

After having some implementation problems with students in the next cohort, Thomas realized two things were giving us problems:

  1. config/application.rb needed to included these lines:
config.stripe.secret_key = ENV[‘STRIPE_SECRET_KEY’] config.stripe.publishable_key = ENV[‘STRIPE_PUBLISHABLE_KEY’] config.stripe.endpoint = ‘/payment/stripe-integration’

2. Stripe will translate its pop-up credit card window to match the language of the user’s computer. This needs to be handled in the application so it doesn’t break when working with someone who doesn’t have English as their default (otherwise the tests will fail):

<script src="https://checkout.stripe.com/checkout.js" class="stripe-button" 
data-key="<%=Rails.configuration.stripe[:publishable_key] %>"
data-description="Thank you message"
data-amount="<%= @totalamount*100 %>"
data-locale="<%= Rails.env.test? ? 'en' : 'auto' %>">
</script>
Like what you read? Give Amber Wilkie a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.