WPForms Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

How to Add Optional Payment to Your WordPress Forms

by Shahzad Saeed on Oct 2, 2017

Do you want your visitors to be able to choose to donate to your nonprofit as they’re filling out a form? Using conditional logic, you can hide fields unless the user chooses a certain option. In this article, we’ll walk you through how to add optional payment to your WordPress form.

Adding Form Fields

The first thing you need to do is install and activate the WPForms plugin. Here’s a step by step guide on how to install a WordPress plugin.

Also, you’ll need to have a form created. See our tutorial on How to Create a Simple Contact Form as an example to get started. You can use any kind of form, but for this tutorial we’ll be using a contact form.

The default contact form comes with Name, Email, and Comment or Message fields. We need to add the Multiple Choice, Credit Card, and Single Item fields to the form.

Customizing Form Fields

The Multiple Choice field comes with three choices but you only need two choices for optional payment. You can simply remove the third choice by clicking on the field in the right panel to edit and then deleting the third choice in the left panel.

optional payments

Since you’ll going to be asking your visitors if they would like to donate, it’ll be a good idea to change the labels for the multiple choice. You can do so by simply clicking on the multiple choice field in the right panel to edit and changing the labels in the left panel.

donation fields label

The Single Item field needs to be set to User Defined so users can enter in their own donation amount. You can do this by configuring the advanced settings for the Single Item field.

user defined

If you need help customizing the donation amounts, you can read this article on how to create a donation form with multiple amounts.

Enabling Conditional Logic

To add optional payment to your form you first need to enable conditional logic. You can enable it by clicking Credit Card » Conditionals » Enable Conditional Logic.

Optional Payment Settings

Once you have enabled conditional logic, you’ll need to configure the settings of when you want the payment option to show up for your users. For a nonprofit donation, you want the payment field to only show up when the user clicks “Yes, I want to donate”.

Lastly, you need to connect to your payment provider by clicking on the “Payments” tab on the left side.

WPForms integrates with both PayPal or Stripe for accepting payments. You can even use set up your form to allow users to choose a payment method.

In this example, we will set up PayPal to process orders. To do this, you first need to install and activate the PayPal addon.

Simply go to WPForms » Addons and click on the install button for PayPal Addon. Once activated, you need to return to your form to configure the PayPal settings.

enable paypal payments

You need to enter your PayPal email address, make sure the mode is in Production and adjust other settings as needed.

After you are done configuring the order form settings, click Save to store your changes and your form is ready to be published on your site.

That’s it! You’ve just added optional payment to your WordPress form.

Want to accept payment for the online orders? Check out how to process payments with your WordPress orders forms.

If you’re looking to save even more time processing online orders, you can check out our tutorial on how to generate FreshBooks invoices automatically from your order form, or create a client booking form that connects with your calendar software.

What are you waiting for? Get started with the most powerful WordPress forms plugin today.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.