Gravity Forms
moat's Gravity Forms add-on turns any form into a payment form — donations, registrations, custom order flows, rentals. Tokenized, PCI-scoped correctly, and works with Gravity's conditional logic.
Gravity Forms is a popular WordPress form builder. The moat add-on adds a Credit Card field, a Payment feed type, and hooks that let you collect a payment on submission — whether the form is a donation page, a conference registration, or a bespoke order form.
Requirements
- WordPress 6.0+.
- Gravity Forms 2.6+.
- PHP 7.4+.
- A moat account.
- HTTPS on the site (required for the hosted Credit Card field).
Install
- Download the
moat-gravity-formsZIP from your Control Panel under Integrations → Gravity Forms. - In WordPress admin, go to Plugins → Add New → Upload Plugin, select the ZIP, activate.
- Navigate to Forms → Settings → moat.
- Enter your public key, secret key, and choose Sandbox or Production.
Add a payment form
1. Add the Credit Card field
Open a form in the editor and add the Credit Card field from the Pricing Fields panel. The field renders moat's tokenizer iframe on the front end, so no card data ever touches your WordPress install.
2. Create a feed
In the form settings, go to moat → Add New. A feed tells the add-on how to charge a submission:
| Setting | Description |
|---|---|
| Feed name | Internal name for your reference. |
| Transaction type | One of Sale, Subscription (for recurring). |
| Payment amount | A total field (e.g. "Form Total"), a product price, or a fixed amount. |
| Customer fields mapping | Map form fields to moat customer fields (name, email, address). |
| Metadata | Optional custom fields to attach to the transaction. |
| Conditional logic | Only run the feed when certain form conditions are met. |
3. Save and test
Preview the form, submit a test in sandbox mode with card 4111111111111111, and confirm the transaction appears in the Control Panel.
Subscriptions
To collect recurring payments via Gravity Forms, set the feed's Transaction Type to Subscription and choose a plan (or configure the plan inline). The add-on will create a customer, save the payment method, and start a subscription on submission. Subsequent renewals happen automatically via moat's recurring engine.
Fee programs
Surcharge / cash discount / dual pricing can be enabled per feed. When enabled, the add-on runs a BIN lookup client-side and shows the fee as a separate line on the form's summary. See Fee Programs.
Conditional logic
Gravity Forms' conditional logic is fully supported:
- Show the Credit Card field only when a paid option is selected.
- Run different feeds based on product selection (e.g. one-time vs. recurring).
- Skip payment entirely when a discount code brings the total to zero.
Post-submission actions
The standard Gravity Forms confirmation, notifications, and post-submission actions all run after a successful payment. If the payment fails, the form returns to the user with an error message on the Credit Card field — submissions are not recorded until payment succeeds.
Hooks
For custom workflows, the add-on exposes WordPress filters and actions. Common ones:
| Hook | Purpose |
|---|---|
moat_gf_transaction_data (filter) | Modify the transaction body before submission to moat. |
moat_gf_after_payment_success (action) | Run your own logic after a successful charge. |
moat_gf_after_payment_failed (action) | Run your own logic on failure. |
moat_gf_customer_data (filter) | Modify customer data before vaulting. |
Troubleshooting
| Symptom | Check |
|---|---|
| Credit Card field not rendering | HTTPS on the page? Browser console showing script blocks? |
| "Feed not processed" | Feed enabled? Conditional logic blocking? Check the Gravity Forms log under Forms → System Status → Logs. |
| Payment succeeds, entry marked failed | Webhook not received. Verify webhook URL and check the Control Panel log. |