I am falling this short tutorial: https://stripe.com/docs/checkout/rails
I created a brand new rails app for it. Yet, when I attempt to make a charge, I get the error "You did not set a valid publishable key. You must call Stripe.setPublishablekey()"
Yet the tutorial itself says nothing about calling that. Here is my code currently:
new.html.erb
<%= form_tag charges_path do %>
<article>
<% if flash[:error].present? %>
<div id="error_explanation">
<p><%= flash[:error] %></p>
</div>
<% end %>
<label class="amount">
<span>Amount: $5.00</span>
</label>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<%= Rails.configuration.stripe[:XXXXXXXX] %>"
data-description="A month's subscription"
data-amount="500"
data-locale="auto"></script>
stripe.rb: (under config/initializers)
Rails.configuration.stripe = {
:publishable_key => "ZZZZZZZZ",
:secret_key => "YYYYYY"
}
Stripe.api_key = Rails.configuration.stripe[:XXXXXX]
Yes, I know the keys should be kept in environment variables. I will figure that out later. For now, I just want to know where I should be calling the Stripe.setPublishableKey()
I have not deployed to heroku yet, but that shouldn't make a difference, since it should still work locally.
