Payment field with Stripe — full flow
This walkthrough connects Stripe to a Formie form end to end: integration setup, Payment field configuration, form behaviour, and optional subscription features.
Prerequisites
- A Stripe account with API keys
- A Formie form that will collect payment
- Ajax (Client-side) submission method on the form (required for Stripe)
Overview
Stripe setup happens in two places:
- Formie → Settings → Payments — create and connect the Stripe integration.
- Form builder — add a Payment field and choose Stripe as the provider.
Payment runs through Formie's submission workflow: the submission is validated and screened, payment is authorised or captured during the save stage, and notifications and integrations dispatch only after payment succeeds (for charge-at-submit flows).
Step 1: Create the Stripe integration
- Go to Formie → Settings → Payments.
- Click New Integration.
- Select Stripe as the provider.
- In the Stripe Dashboard → API Keys (opens new window), copy the Publishable Key and Secret Key.
- Paste them into Formie. Store keys in
.envvariables and reference them in the integration settings — do not commit secrets to project config. - Save and click Refresh in the sidebar to test the connection.
Use Stripe Test Mode keys while developing; switch to live keys before production.
Step 2: Configure webhooks (subscriptions)
Webhooks are required for subscription payments and recommended for reliable status updates.
- In Stripe, open Developers → Webhooks.
- Click Create an event destination.
- Copy the Redirect URI from Formie integration settings into Stripe's Endpoint URL.
- Select events — at minimum:
customer.subscription.createdcustomer.subscription.deletedcustomer.subscription.updatedinvoice.createdinvoice.payment_failedinvoice.payment_succeededpayment_intent.succeededpayment_intent.payment_failedpayment_intent.canceledplan.deletedplan.updated
- Copy the Signing secret into Formie's Webhook Signing Secret field.
Step 3: Add a Payment field
- Edit your form.
- Set Submission Method to Ajax (Client-side). Stripe tokenisation requires Formie's client submission flow.
- Add a Payment field.
- Select your Stripe integration for Payment Integration.
- Configure Amount — fixed value, dynamic value from another field, or use Calculations to derive the amount.
- Map Billing details — name, email, address fields — to Stripe's expected customer data.
Save the form and preview on the front end. Stripe Elements (or the configured hosted UI) should render inside the Payment field.
Step 4: Submit and verify
- Submit a test payment using Stripe test card
4242 4242 4242 4242. - Confirm the submission appears in Formie → Submissions with payment metadata.
- Check that email notifications and integrations fired after successful payment.
Failed payments should surface as submission errors on the form without creating a completed paid submission.
Subscriptions
For recurring payments:
- Edit the Payment field and set Payment Type to Subscription.
- Configure the recurring amount and interval per Stripe integration settings.
Payment limits
Limit how many billing cycles Stripe collects before auto-cancelling:
- Under Payment Limit, choose Fixed Value or Dynamic Value.
- Enter a count (for example
3for three instalments) or select a Number field.
Formie creates the subscription through a Stripe subscription schedule. Leave No limit for ongoing subscriptions.
Setup fees
Charge a one-time fee on the first invoice:
- Under Setup Fee, choose Fixed Value or Dynamic Value.
- Optionally set Setup Fee Description for the Stripe invoice line item.
Setup fees use Stripe add_invoice_items on the first subscription invoice.
Modify subscription payloads with the modifySubscriptionPayload and modifySubscriptionSchedulePayload events if your project needs custom Stripe parameters.
Dynamic amounts with Calculations
When the payment amount depends on other fields:
- Add Number or Dropdown fields for the inputs.
- Add a Calculations field for the total.
- On the Payment field, set amount source to the Calculations field (dynamic value).
The Calculations field updates on the front end as inputs change; the Payment field reads the computed value at submit time.
Troubleshooting
| Symptom | Check |
|---|---|
| Stripe UI does not appear | Form must use Ajax submission; confirm publishable key and front-end assets load |
| Payment succeeds but no submission | Webhook/callback configuration; check Craft logs for payment replay errors |
| Integration refresh fails | Secret key, API mode (test vs live), server outbound HTTPS |
| Subscriptions stuck pending | Webhook signing secret and required subscription events |