title: Multiple stripe payment buttons on one page of rails 4 app
body: <p>I'm building a payment page that lists three different subscription options and am using Stripe's checkout to manage the payments.</p>
  
  <p>The page is rendering properly, and all 3 subscription options have the "buy now" button that should be linked to Stripe.</p>
  
  <p>My issue is that the first button is the only one that is properly pulling up the Stripe checkout flow.  Buttons 2 and 3 throw the following error:</p>
  
  <p>Unknown action
  The action 'index' could not be found for ChargesController</p>
  
  <p>The relevant part of my payment page is:</p>
  
  <pre><code>  &lt;% @plans.each do |plan| %&gt;
      &lt;li class="col-md-3 plan &lt;%= 'plan-primary' if plan.highlight? %&gt;"&gt;
        &lt;div class="img-thumbnail"&gt;
          &lt;div class="caption"&gt;
            &lt;h3&gt;&lt;%= plan.name %&gt;&lt;/h3&gt;
            &lt;h4&gt;&lt;%= plan_price(plan) %&gt;&lt;/h4&gt;
            &lt;div class="call-to-action"&gt;
              &lt;% if @subscription.nil? %&gt;
               &lt;% if plan.highlight? %&gt;
  
                &lt;%= form_tag main_app.charges_path do %&gt;
                  &lt;script src="https://checkout.stripe.com/checkout.js"&gt;&lt;/script&gt;
  
                    &lt;button id="customButton" class="btn btn-success"&gt;Buy Now&lt;/button&gt;
  
                    &lt;script&gt;
                      var handler = StripeCheckout.configure({
                        key: '&lt;%= 'pk_test_my_pk' %&gt;',
                        image: '/assets/my_logo.png',
                        token: function(response) {
                          var tokenInput = $("&lt;input type=hidden name=stripeToken /&gt;").val(response.id);
                          var emailInput = $("&lt;input type=hidden name=stripeEmail /&gt;").val(response.email);
                          $("form").append(tokenInput).append(emailInput).submit();
                        }
                      });
  
                      document.getElementById('customButton').addEventListener('click', function(e) {
                        handler.open({
                          name: 'My Co',
                          description: 'Listing subsctiption ($50.00)',
                          amount: 50*100,
                          shippingAddress: false
                        });
                        e.preventDefault();
                      });
                    &lt;/script&gt;
                &lt;% end %&gt;
  
                &lt;% else %&gt;
                 &lt;%= form_tag main_app.charges_path do %&gt;
                  &lt;script src="https://checkout.stripe.com/checkout.js"&gt;&lt;/script&gt;
  
                    &lt;button id="customButton" class="btn btn-large btn-primary"&gt;Buy Now&lt;/button&gt;
  
                    &lt;script&gt;
                      var handler = StripeCheckout.configure({
                        key: '&lt;%= 'pk_test_my_pk' %&gt;',
                        image: '/assets/my_logo.png',
                        token: function(response) {
                          var tokenInput = $("&lt;input type=hidden name=stripeToken /&gt;").val(response.id);
                          var emailInput = $("&lt;input type=hidden name=stripeEmail /&gt;").val(response.email);
                          $("form").append(tokenInput).append(emailInput).submit();
                        }
                      });
  
                      document.getElementById('customButton').addEventListener('click', function(e) {
                        // Open Checkout with further options
                        handler.open({
                          name: 'My Co',
                          description: 'Listing subsctiption ($40.00)',
                          amount: 40*100,
                          shippingAddress: false
                        });
                        e.preventDefault();
                      });
                    &lt;/script&gt;
                &lt;% end %&gt;
  
  
              &lt;% end %&gt;
  </code></pre>
  
  <p>Ideas on why only one of the 3 buttons is working properly?</p>
  
  <p>Thanks!</p>