How to pre-populate email in the Stripe payments dialog popup

If you’re using Simple Checkout you pass the email in data-email like this:

<form action="/charge" method="POST">
  <script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
    data-image="/img/documentation/checkout/marketplace.png"
    data-name="Stripe.com"
    data-description="2 widgets"
    data-amount="2000"
    data-email="[email protected]"
    data-locale="auto">
  </script>
</form>

If you’re using Custom Checkout you pass the email in the email parameter to handler.open():

handler.open({
  name: 'Stripe.com',
  description: '2 widgets',
  amount: 2000,
  email: "[email protected]"
});

Leave a Comment

tech