Stripe

Take a payment after a FormDB submission with a Stripe Buy Button, and connect your Stripe account to see payment status in the inbox.

This page explains how to collect a payment after someone submits your form, using a Stripe Buy Button on your own page, and how to see the payment status next to each submission in FormDB.

Paid plans: Integrations are available on Starter, Growth and Business.

How it fits together

FormDB does not process payments and does not host a checkout page. The payment is made through your own Stripe account, with a Buy Button you create in Stripe. FormDB's part is to link each payment to the right submission.

There are two pieces, both in the Stripe payments card on a form's Integrations tab:

  • Buy Button. You save your Buy Button's details, and FormDB generates the embed code for your site.
  • Stripe Connect. You connect your Stripe account with read-only access, so FormDB is told when a payment succeeds or fails and can show it in the inbox.

You can use the Buy Button without connecting your account. Payments will still work, but FormDB cannot show their status.

The flow for a visitor is:

  1. They fill in your form. Your page submits it to FormDB with JavaScript and receives the submission's id.
  2. Your page shows the Stripe Buy Button, tagged with that id.
  3. They pay in Stripe's checkout.
  4. Stripe tells FormDB about the payment, and the submission is marked as paid.

Step 1: create a Buy Button in Stripe

In your Stripe dashboard, create a Buy Button for the product or price you want to sell. You need two values from Stripe:

  • The Buy Button ID, which starts with buy_btn_.
  • Your account's publishable key, which starts with pk_test_ or pk_live_.

The price, currency and product are all set in Stripe, not in FormDB. The publishable key is designed to be public. FormDB never asks for your Stripe secret key.

Step 2: save it in FormDB

You need the admin or owner role.

  1. Open the form and go to the Integrations tab.
  2. In the Stripe payments card, under Buy Button, paste the Publishable key and the Buy Button ID.
  3. Click Save Buy Button.

The card now shows an embed snippet like this:

<script async src="https://js.stripe.com/v3/buy-button.js"></script>

<stripe-buy-button
  buy-button-id="buy_btn_your_button_id"
  publishable-key="pk_live_your_publishable_key"
  client-reference-id="form_your-form-id_sub_SUBMISSION_ID"
></stripe-buy-button>

The client-reference-id is how the payment is linked to a submission. SUBMISSION_ID is a placeholder that your page must replace with the real ID of the submission.

Step 3: connect your Stripe account

  1. In the same card, click Connect.
  2. Approve the request in Stripe. FormDB asks for read-only access.
  3. Back in FormDB, the card shows Active and your connected account ID.

Step 4: show the button after a submission

The snippet does not submit your form or fill in the ID by itself. Your page needs a little JavaScript to do that: submit the form, read the id from the response, then add the Buy Button with the ID in place.

Here is a complete example:

<script async src="https://js.stripe.com/v3/buy-button.js"></script>

<form id="order-form">
  <label for="name">Name</label>
  <input type="text" id="name" name="name" required />

  <label for="email">Email</label>
  <input type="email" id="email" name="email" required />

  <input type="text" name="_gotcha" tabindex="-1" autocomplete="off" style="display:none" />

  <button type="submit">Continue to payment</button>
  <p id="order-status" role="status"></p>
</form>

<div id="payment"></div>

<script>
  const FORM_ID = "your-form-id";
  const form = document.getElementById("order-form");
  const status = document.getElementById("order-status");

  form.addEventListener("submit", async (event) => {
    event.preventDefault();

    const response = await fetch("https://api.formdb.io/f/" + FORM_ID, {
      method: "POST",
      headers: { Accept: "application/json" },
      body: new FormData(form),
    });
    const body = await response.json();

    if (!body.ok) {
      status.textContent = body.error.message;
      return;
    }
    if (!body.id) {
      return;
    }

    const button = document.createElement("stripe-buy-button");
    button.setAttribute("buy-button-id", "buy_btn_your_button_id");
    button.setAttribute("publishable-key", "pk_live_your_publishable_key");
    button.setAttribute("client-reference-id", "form_" + FORM_ID + "_sub_" + body.id);

    form.hidden = true;
    document.getElementById("payment").appendChild(button);
  });
</script>

The form must be submitted with Accept: application/json, because only the JSON response contains the submission id. See JavaScript and AJAX.

See payment status

Once your Stripe account is connected and a visitor pays:

  • In the Submissions table, the submission shows a Paid badge. Other states show the status name, such as Pending or Failed.
  • Opening the submission shows a Stripe payment block with the status, the Amount and the Customer email.

Payment status is one of pending, completed or failed. FormDB updates it when Stripe reports that a checkout was completed, that a delayed payment succeeded, or that a delayed payment failed.

FormDB only records payments from the Stripe account connected to that form.

Payments without a submission ID

If the Buy Button's client-reference-id contains only the form part, form_your-form-id, with no submission ID, FormDB creates a new entry in the form's inbox for each payment. It contains the customer's email and name from Stripe. This lets you take payments with a Buy Button alone, without a form in front of it.

Entries created this way do not count toward your submission quota, and do not send notification emails or trigger other integrations.

Disconnect

  • Disconnect Stripe removes FormDB's access to your Stripe account. Payment status is no longer updated.
  • Remove, next to the Buy Button, deletes the saved Buy Button details from FormDB.

Neither action changes anything in your Stripe account's products, buttons or past payments.

What is not covered

  • Refunds and subscriptions are not tracked. Check your Stripe dashboard for those.
  • Payment amounts cannot be set or changed in FormDB.
  • Stripe is the only payment provider supported.
  • Stripe payments do not appear in the Recent deliveries log.

Next steps

Ready to try it? Create a free account and send your first submission.