bookmark_borderSetting Up Conditional Payments in Gravity Forms
Sometimes, you may want to allow a user to either pay with one payment gateway or another. In this article, we will show you how to send a payment to either PayPal or Stripe based on the user’s options using conditional logic. You can apply the same setup to any other combination of different payment gateways within a form (e.g. PayPal + Authorize.net).
Note: This article assumes that you already know how to create a payment form, as well as you have installed the add-ons for all payment gateways you need.
- First either create or access your payment form by clicking on Forms on the left side navigation menu, and then clicking on the form that you want to enable multiple payment gateways on.
- If you want a user to be able to select the payment gateway, add a Radio Button field type to your form, with each option being the different payment options. In this example, we will be using PayPal and Stripe, so both of these options will be labeled accordingly as PayPal and Credit Card within a radio button field.
- Next, we need to display the credit card form conditionally based on the payment selection. As PayPal Standard is handled off-site, there’s no need for the user to fill out the credit card form. To do so, click on the Credit Card field, click on the Advanced tab, and check the Enable Conditional Logic checkbox. Once the conditional logic option appears, simply configure this field to only show if the Credit Card radio button is selected.
- That’s all we need from the form itself. Now, we’re on to configuring conditional logic within our feeds for each payment gateway. On the top of the page, hover over Form Settings and click on the payment gateway you want to configure. As you are likely already using this payment gateway, you likely already have a feed so we won’t go through the process of creating feeds, but you can find that information if you need it within the documentation for the addon you are using. Simply access the feed you want to use. In this example, we will be configuring PayPal’s feed, but the steps will be the same for any other payment gateway add-on.
- Within the feed, there is an option labeled Conditional Logic. Simply check the checkbox beside it to enable conditional logic.
- To configure your condition, simply set it to occur (or not occur) based on your desired selection. This this example, we are letting the user choose between PayPal and credit card options, and are configuring the PayPal feed, so we simply set the condition to occur only if the PayPal radio button is selected.
- From here, continue to set up any other feeds that will occur based on the user’s selection.
Congratulations. You have now successfully set up multiple payment gateways using conditional logic in Gravity Forms.