title: How to implement a Stripe Checkout custom button
body: <p>According to the documentation, Checkout supports two different integrations: Simple and Custom.</p>
  
  <p>The simple way works for me:</p>
  
  <pre><code>**&lt;form action="create_subscription.php" method="POST"&gt;**
  &lt;script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="asdsdfasd3232"
    data-amount="2000"
    data-name=""
    data-description="2 widgets"
    data-image="https://s3.amazonaws.com/stripe-uploads/acct_19EnQrGHC6pu6Qvdmerchant-icon-1485553962843-logo_stripe.png"
    data-locale="auto"&gt;
  &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>However in the custom way I don't understand <strong>how and where</strong> should I call the "create_subscription.php" script. This is the custom integration code:</p>
  
  <pre><code>&lt;script src="https://checkout.stripe.com/checkout.js"&gt;&lt;/script&gt;
  
  &lt;button id="customButton"&gt;Purchase&lt;/button&gt;
  
  &lt;script&gt;
  var handler = StripeCheckout.configure({
    key: 'asdsdfasd3232',
    image: 'https://s3.amazonaws.com/stripe-uploads/acct_19EnQrGHC6pu6Qvdmerchant-icon-1485553962843-logo_stripe.png',
    locale: 'auto',
    token: function(token) {
      // You can access the token ID with `token.id`.
      // Get the token ID to your server-side code for use.
    }
  });
  
  document.getElementById('customButton').addEventListener('click', function(e) {
    // Open Checkout with further options:
    handler.open({
      name: '',
      description: '2 widgets',
      amount: 2000
    });
    e.preventDefault();
  });
  
  // Close Checkout on page navigation:
  window.addEventListener('popstate', function() {
    handler.close();
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I've tried this code, but it is not working. Can someone point me in the right direction?</p>
  
  <pre><code>&lt;form action="/create_subscription.php" method="POST"&gt;
        &lt;script src="https://checkout.stripe.com/checkout.js"&gt;&lt;/script&gt;
        &lt;div id="stripe-demo" class="evo-button rounded cele"&gt;
        &lt;span&gt;Register&lt;/span&gt;
        &lt;/div&gt;
  
        &lt;script&gt;
        var handler = StripeCheckout.configure({
          key: "asdsdfasd3232",
          image: "img/logo.png",
          name: "",
          description: "Subscription for 1 month",
          panelLabel: "Sign Me Up!",
          amount: "2000",
          allowRememberMe: false
        });
  
        document.getElementById('stripe-demo').addEventListener('click', function(e) {
          handler.open();
          e.preventDefault();
        });
  
        window.addEventListener('popstate', function() {
          handler.close();
        });
        &lt;/script&gt;
      &lt;/form&gt;
  </code></pre>