Now that FormAssembly has added Stripe integration, it’s easier than ever to add Stripe payment options to your forms. But what if you want to give your users a choice between PayPal payments or credit card payments through Stripe, all within a single form? With a setup like this, your respondents who feel more comfortable using PayPal have that option, but those who don’t have the service, or would rather pay through their credit card, can do so as well. It’s the best of both payment worlds!
So, what’s the first step in getting a form like this built? Well, aside from getting a FormAssembly account and knowing your way around the Form Builder, we’re going to cover two examples.
The first will be more simple, and won’t involve more than a single quantity. In other words, this setup is perfect in situations where only one of something is being purchased. For example, maybe it’s a single donation, or a consulting fee.
The second example will get just a little bit more complicated, as we’ll be working with quantities and you’ll have to use some formulas, but we’ll walk you through everything you’re going to need to build the form from scratch.
Example 1: A Purchase of One
For this first example, as mentioned above, we’ll be dealing with a situation where a person would only want to purchase one of something. And we’ll be starting with an incredibly simple form:
The only thing special about this form is that if the respondent selects “Credit Card,” then a conditional section asking for their payment information will pop up. You can even use our new predefined content to quickly add a payment information section, and it’ll only take a second to set up:
Other than that, there’s nothing else this form needs. No fancy formulas, no calculations, just the basics you see above!
Now we’re ready to head into the connectors to get things set up on that side, and we’ll need a connector for both Stripe and PayPal in order for this to work correctly. If you’re new to these payment connectors, you might want to check out those links in the last sentence, and we’ve got some great introductory videos to help you get started with the basics. But if you’re ready to dive in, let’s check out this setup.
Before looking at the configuration, the main idea here is that when a respondent selects they want to use a credit card (i.e. a Stripe Payment), we want the quantity in the Stripe Connector to be set to 1 and the quantity in the PayPal connector to be set to 0. As long as a connector’s quantity is set to 0 nothing will be processed. Alternatively, when a respondent selects they want to use PayPal, the opposite will be true and the Stripe Connector quantity will be set to 0 while the PayPal quantity will be set to 1.
In order to set that up, after you finish all the basic field mappings for payment information, you’ll need something along these lines in your Stripe connector under the one-time charges:
As you can see, if the respondent selects they want to pay with Credit Card in the form, it will set the quantity to 1 and if they select PayPal it will set the quantity to 0.
And guess what, that’s the only special thing you need to set up in the Stripe connector, everything else is business as usual! You can define the price in the connector or in the form, you can set up shipping information if you want to, but the only thing you really need for this configuration to work, is making sure the quantity mapping is setup like you see above.
Now let’s head over to the PayPal Connector. You’ll see it’s a pretty similar story on this side.
Just like we had things set up in the Stripe Connector, you’ll want to set the PayPal mapping like this:
That way, when your respondent selects PayPal as their payment method, the quantity will be set to 1, and if they select Credit Card the quantity will be set to 0.
With both your connectors set up like this, the PayPal connector won’t run when someone selects Pay with Credit Card and the Stripe Connector won’t run when someone selects Pay with PayPal.
Once you have the rest of your PayPal mappings completed as normal, that’s all there is to it! You’re ready to start processing PayPal or Stripe payments from within a single form.
Example 2: Quantity Over No Quantity
So the above example is great for situations where your respondents are only purchasing a single item, or making a one-time donation, or something along those lines. But what happens if you want to add a quantity functionality to the form, so that people can pick how many of something they’re going to be buying?
This is definitely possible as well, but things will get just a little bit trickier and you’ll need to use a couple hidden fields as well as a few calculations. But don’t let that worry you, we’ll walk you through all the steps you’ll need to do in order to make your setup as easy as possible.
To start with, our form is going to look a little different:
The greyed out text you see are hints to help with the formulas we’ll need to add, and we’ll get to those in just a moment. For now, if you’d like to see the form in action, you can check it out here.
Before we get into the formulas, let’s talk about the basic setup. As with our first example, the only conditionals you’ll need to add is a payment information section if a user clicks on Credit Card.
Next, let’s talk about the variables! There are two variables you’ll need to set up. The first, we’ve called quantity and, you probably guessed it, this is defined by the first field, when the user types in How Many of your item they want.
For the How Much field, this could be set up as a radio button, left empty for the user to define a price, or basically built however you would like to for your use case, but in this example it’s not a calculation or a variable, it just represents what the cost of what one item would be.
The next variable we need to set up is for the How would you like to pay field. Here, we’ve given the Credit Card selection a value of 1 and the PayPal selection a value of 2. We’ve also named this variable method:
The last thing we need to set up are the formulas for the fields called Stripe Quantity and PayPal Quantity. In your form, these fields would probably be hidden, to avoid any confusion, but in the example form, they’re visible for explanatory purposes.
Just like before, we want the PayPal quantity to be set to 0 if someone selects Credit Card and vice versa. However, this is a little more complicated as we’re not just dealing with single quantities this time.
In order to set this up, we’ll need to mark those two fields as calculated and you’ll want to enter the following:
For the Stripe Quantity:
For the PayPal Quantity:
What these formulas are essentially saying is, for example with the Stripe Quantity, if someone has selected Credit Card and therefore the method variable equals 1, then use the quantity variable for this field. Otherwise (i.e., if the user selected PayPal), set the value of this field to 0.
This way, when someone selects that they want to pay with Credit Card, the Stripe Quantity field will be set to whatever they enter as their quantity. But, if they select they want to pay with PayPal, the Stripe Quantity will be set to 0 so, just like before, the connector won’t run.
Once you have those formulas in for the Stripe Quantity and PayPal Quantity, we’re ready to jump back to the connectors. As you’ve seen, the form building setup for this example was a little bit more complicated than the first one, but hopefully still not too bad.
Now that we’ve gotten through those formulas, we’re into the home stretch, and there’s not a whole lot we have to set up on the connector side.
In fact, really the only thing special is that you’ll need to make sure that Stripe Quantity field with the formula from before is mapped to the quantity field in the connector:
Other than that, everything will be set up normally!
You’ve probably already guessed this, but on the PayPal side, we’ll be doing exactly the same thing, except we’ll want to map the PayPal Quantity field with the formula in it to the quantity field in the connector:
Using these two examples, if someone selects that they want to pay with Credit Card, the quantity will only be set in the Stripe Connector; the PayPal quantity will be set to 0, and the PayPal Connector won’t be run. Likewise, if PayPal is selected, the Stripe quantity will be set to 0, and the Stripe Connector won’t run.
By setting your form up this way, you can give your respondents a choice in the payment method they want to use, even if you want them be able to purchase more than one of any item! In short, it’s the best of both payment worlds and your users have the freedom to use their credit card, or PayPal, depending on whichever is best for them!
Stripe and PayPal Payments Templates, Ready to Go!
Need a form that’s ready to use right away? We’ve designed these two templates for you! The connectors are all mapped and configured, so all you need to do is log in with your Stripe and PayPal credentials in order to start collecting payments! Check them out: