Signup Forms

HTML forms can be used to sign up subscribers to your Lemon Squeezy email list, with POST requests to a specified endpoint and optional JavaScript for custom post-submission actions.


You can use HTML forms to let people to sign themselves up to your email marketing list. This is great if you use Lemon Squeezy as your main email marketing tool, rather than just communicating with existing customers.

Use a typical HTML signup form on your website and every submission will be added as a Subscriber in your Lemon Squeezy account.

The endpoint for the form is:

https://[STORE].lemonsqueezy.com/email-subscribe/external

[STORE] is the URL of your store (configured in your store settings).

Send a POST request to this endpoint with two variables:

  • email - The email address of the subscriber
  • name - (optional) The name of the subscriber
<form action="https://my-store.lemonsqueezy.com/email-subscribe/external" method="post">
    <div>
        <label for="name">Name</label><br>
        <input type="text" name="name" id="name" required>
    </div>
    <div>
        <label for="email">Email</label><br>
        <input type="email" name="email" id="email" required>
    </div>
    <button type="submit">Submit</button>
</form>

When the form is submitted, the subscriber will be redirected to a Lemon Squeezy-hosted confirmation page with a button linking to your storefront.

Lemon Squeezy: signup confirmation

For more flexibility you can use Javascript to submit the form. The following example posts the form using AJAX, which enables changing the post-submission redirect to a custom URL.

<form id="signupForm" method="post">
  <div>
    <label for="name">Name</label><br />
    <input type="text" name="name" id="name" required />
  </div>
 
  <div>
    <label for="email">Email</label><br />
    <input type="email" name="email" id="email" required />
  </div>
 
  <button type="submit">Submit</button>
  <div id="loader" style="display:none">Submitting...</div>
</form>
 
<script>
  const STORE = 'my-store'; // Change "my-store" to your store slug
  const form = document.getElementById('signupForm');
  const loadingMessage = document.getElementById('loader');
  const formUrl = `https://${STORE}.lemonsqueezy.com/email-subscribe/external`;
  const redirectUrl = 'https://myapp.com/signup-success/'; // Use your own URL here
 
  form.addEventListener('submit', async (e) => {
    e.preventDefault();
    showLoading();
 
    try {
      const response = await fetch(formUrl, {
        method: 'POST',
        body: new FormData(e.target),
      });
      
      if (!response.ok) {
        throw new Error("Subscription failed.");
      }
 
      window.location.href = redirectUrl;
    } catch (error) {
      alert(`Sorry, there was an issue: ${error}`);
    } finally {
      hideLoading();
    }
  });
 
  function showLoading() {
    form.querySelector('button').disabled = true;
    loadingMessage.style.display = 'block';
  }
 
  function hideLoading() {
    form.querySelector('button').disabled = false;
    loadingMessage.style.display = 'none';
  }
</script>

Was this page helpful?