Caldera Forms offers an array of payment gateways that gives you the opportunity to receive payments for memberships, donations, products and much more. Some of the popular gateways for Caldera Forms are PayPal Express, Stripe and Braintree. A couple of users have been curious to accept payments from multiple gateways with Caldera Forms, in this example we will be using the PayPal Express and Stripe add-ons.
Start accepting payments with Caldera Forms
Depending on your payment gateway, you may need to capture additional billing details. In this example, we don’t need to capture any additional data. I have created a simple donation form that a user will be able to donate $5, $10 or $15 through Caldera Forms and either choose PayPal or Stripe as their payment gateway. With this example, you are able to extend it to use all payment gateways that Caldera Forms offer – in this case the form consists of the following fields: name, email, dropdown (with the donation amounts), radio button to select the payment gateway, a hidden field for the payment gateway amounts which uses Caldera Forms field sync to match the dropdown value the user selected and pass it to the payment gateway and a submit button.
It is important to have a radio box so that only one option may be selected at a time for checkout. We will use this for our payment gateway processor conditions and select the correct payment gateway according to the user selection and that it is required. Note: some payment gateways require hidden fields to accept payments with Caldera Forms, in this case I have created a hidden field and used the value of the dropdown field as the default value for the hidden field by using
%the_dropdown_slug% magic tags.
The logic behind accepting payments from multiple gateways
If you aren’t familiar with conditions in Caldera Forms, I highly suggest having a read at Caldera Forms Getting Started: Using Form Conditionals. Once the general form is setup, we will add our payment gateway processors and insert all the relevant information such as secret keys, merchant ID’s and so on. Once this is setup, you will be able to create a condition which is found next to the ‘settings’ tab inside the relevant payment gateway processor.
Once you have selected this tab, select ‘use’ which means this processor will only be used if the certain condition is met. In our case, if the user selects ‘PayPal’ use the PayPal processor or if the user selects ‘Stripe’ use the Stripe processor. Select ‘Add a conditional group’ and add the following conditional logic:
if the radio box has paypal selected use this processor.
You will create a condition similar to this for each payment processor you are using within a form, which allows you to accept as many payment gateways as you would like.
One thought on “Accepting payments from multiple gateways in WordPress”