Documentation, Reference Materials and Tutorials for WPForms
Would you like to collect payments directly within your form? With our Stripe addon, you can provide an easy way for users to submit one-time payments, or even recurring/subscription payments, without ever leaving your site.
In this article, we’ll show you how to install and set up the Stripe addon with WPForms.
- Connect Stripe to Your WordPress Site
- Add Stripe to Your Forms
- (Optional) Set Up Conditional Logic for Payments
- Frequently Asked Questions
1. Connect Stripe to Your WordPress Site
For information on how to set this up, please see WPBeginner’s guide to adding SSL and HTTPS in WordPress.
Once the Stripe addon is ready to go, you’ll need to open WPForms » Settings in the left menu of your WordPress site. From there, click on the Payments tab.
If you’d like to adjust the currency, go ahead and select the option you need from the Currency dropdown before proceeding.
When you’re ready, scroll down to the Stripe section. Here, you’ll see several fields for Stripe keys need to be filled out to connect your website and Stripe account.
To find these keys, you’ll need to log into your Stripe account. Be sure to do this in a new tab or window, as we’ll be returning to those payment settings soon.
We’ll start by copying the test keys. Stripe’s test keys will be used if you test Stripe payments, which we recommend doing before adding your form to a live page.
After logging in, click API in Stripe’s left menu. Under the section titled API Keys, you should see a notice that reads, “Viewing test API keys, toggle to view live keys”. This means that the keys shown here are the test keys you’ll need to copy.
When you return to your WPForms payment settings page to paste in these test keys, be careful to place them in the correct fields. The key names will help with this, as the key that begins with
pk_test_ will go in the Test Publishable Key field and the key that begins with
sk_test_ will go in the Test Secret Key field.
Next, we’ll need to copy the live keys, which will be used to collect actual payments when your form is displayed on your site. To find your live keys in Stripe, you’ll need to toggle the option that currently reads Viewing test data.
When you switch to the live keys, you’ll see a very similar screen. But you can quickly check that these are the keys you need by again looking to the beginning of each key. The Live Publishable Key will begin with
pk_live_, and the Live Secret Key will begin with
You’ll need to copy these live keys into your WPForms payment settings, as well. Then once all of the Stripe keys have been added to your payment settings, click Save Settings.
2. Add Stripe to Your Forms
Now that you’ve connected Stripe to your WordPress site, you can start adding Stripe payments to your forms.
First, you’ll need to create a new form or edit an existing form.
In order for a form to work with Stripe, you’ll need at least two fields in your form:
- An items field (Single Item, Multiple Items, or Dropdown Items)
- A Credit Card field
For our example, we’ll create a simple order form that includes Name, Email, Dropdown Items, Total, and a Credit Card field.
Once any fields you’d like have been added to the form builder, you’ll need to go to Payments » Stripe. From the Stripe panel, check the box labeled Enable Stripe payments.
Then you’ll be able to enter a short Payment Description, which will appear on the user’s credit card statement. Last, under Stripe Payment Receipt you can choose an Email field from the form where Stripe can send a receipt.
For one-time payments, you’re all set! If you’d like to set up a recurring payment, please continue to the next section.
Recurring / Subscription Payments
You can easily set up a subscription payment within this same settings panel. Under the section titled Subscriptions, go ahead and check the box labeled Enable recurring subscription payments.
Once you’ve checked this box, additional settings will appear.
Here are the fields you’ll need to complete with more details:
- Plan Name: You’ll need to enter a title for the subscription, such as “Donation to X”. This will appear within the Stripe transaction.
- Recurring Period: You can choose how often the recurring payments should occur: Daily, Weekly, Monthly, Quarterly, Semi-Yearly, or Yearly.
- Customer Email: Within this dropdown, select an Email field from your form where the customer can be contacted. This is required to create a subscription for a customer in Stripe.
3. (Optional) Set Up Conditional Logic for Payments
The Stripe addon settings also include the option to set up conditional logic. Conditional logic lets you create “smart forms” that automatically change the form based on a user’s selections.
There are many ways you can use conditional logic with Stripe payments, for example:
- Letting your users choose whether to pay with Stripe or PayPal
- Making payment optional
- Letting your users choose whether to submit a one-time payment/donation or start recurring payment/donation
As an example, we’ll set up the last option from that list and let users choose whether to submit a one-time or recurring donation.
To get started, we’ll create a simple donation form. This will need to include either a Dropdown or Multiple Choice field that will let users choose whether they’d like to submit a one-time donation or set up recurring donation.
In our form, we’ll let users choose between two payment options: One-time and Monthly.
Next, we can return to our Stripe settings under Payments » Stripe. We’ve already followed the steps in the previous section to configure the basic settings, so now we need to set up logic for our recurring payment options.
First, we’ll set up the monthly recurring payment option. For this option the Recurring Period needs to be set to Monthly.
Then, we can scroll to the bottom of the settings (under the Subscriptions section) and check the box labeled Enable conditional logic.
This will display additional fields where you can set up any conditional rules. For our example, we’ll set up a conditional rule that states:
Process payment as recurring if Donation Type is Monthly.
This is all that’s needed to set up a conditional recurring payment!
Frequently Asked Questions
How do I test Stripe payments in my forms?
The best way to test out your forms is to submit an entry and follow the same steps as your users. We recommend setting up Stripe’s Test Mode before adding your form to a live page, which allows you to test transactions before accepting actual payments.
How can I see if a payment is set up as a recurring subscription?
The easiest way to quickly see that a payment is recurring is to go to WPForms » Entries. Be sure you have the correct form selected in the upper left corner.
All entries for the form will be listed here. The Status column will include a dollar icon if a payment was made. If the payment is recurring, you’ll also see a circular arrow icon under the Total column.
How do I view purchase/subcription details in Stripe?
To easily access payment details in Stripe, go ahead and open an individual entry. In the right sidebar, you’ll see a section titled Payment Details. Here, you can see basic information or click the blue link to view details within Stripe.
For one-time purchases, you’ll see a single blue link (under Transaction ID).
For subscriptions, you’ll see three blue links in this same sidebar location (Transaction ID, Subscription ID, and Customer ID). Each link will take you to the relevant details page in your Stripe account.
How can I cancel a subscription for a customer?
To cancel a subscription, you’ll need to open the individual entry and then look to the Payment Details section in the right sidebar. From here, you can click the Subscription ID link to open subscription details for this customer in Stripe.
At the top of this page in Stripe, you can click the Cancel Subscription button.
That’s it! You can now set up one-time and subscription payments for your forms with the WPForms Stripe addon.
Now that you’ve set up an order form, would you like to start boosting sales? Be sure to check out our tutorial on optimizing your order forms to learn how.
- Fixed: Stripe API error
- Important: The addon structure has been improved and refactored. If you are extending the plugin by accessing the class instance, an update to your code will be required before upgrading (use `wpforms_stripe()`).
- Added: Recurring subscription payments! 💥🎉
- Changed: Improved metadata sent with charge details.
- Changed: Enable Credit Card field when addon is activated; as of WPForms 1.4.6 the credit card field is now disabled/hidden unless explicitly enabled.
- Changed: Improved enforcement of Stripe processing with required credit card fields.
- Changed: Remove JS functionality adopted in core plugin
- Changed: Use settings API for WPForms v1.3.9.
- Changed: Improved performance when checking for credit card fields in the form builder
- Changed: Updated Stripe API PHP library
- Changed: Improved Stripe class instance accessibility
- Changed: Check for charge object before firing transaction completed hook
- Added: Support for Dropdown Items payment field
- Added: New action for completed transactions,
- Added: New filter stored credit card information,
- Added: Expanded support for additional currencies
- Fixed: Localization issues/bugs
- Added: Conditional logic for payments
- Changed: Improved error logging
- Changed: Prevent plugin from running if WPForms Pro is not activated
- Fixed: PHP notices with some configurations
- Initial release.