When your website is selling a product, you usually want a storefront. Things like WooCommerce are built to take payments, and they connect very well with processors like Paypal and Stripe.
But what if you just want to take donations? You could use PayPal and create a donate button. That would be a simple solution and if all you care about is a way to allow people to send you money and don’t need to gather anything else, it’s about as straightforward as they come.
What follows is a case study with instructions about how we created a donation form in WordPress using Gravity Forms and PayPal.
Designing a more elegant solution
I have a client, a church, that wanted to allow their members to be able to submit their offerings online. They had a few specific requirements:
- make a one time donation
- option to make a recurring donation (monthly and weekly options)
- earmark the donation
- gather a bit of personal info
And they didn’t want to have multiple buttons to do the job.
We talked about it and eventually settled on two tools, one of which we were already using for contact forms: Gravity Forms and PayPal.
How we did it
The easy part was creating the form. Gravity has a nice selection of field options, so in addition to the standard personal information fields, we set up two fields that drive the actual donation: an amount field and a frequency field. Amount has to be a “Product” field from the Pricing section of field options, and frequency in our case is a radio button with one-time, weekly, and monthly options.
The second step is to set up the PayPal options, which are called Feeds in the Gravity settings.
We added three feeds, one for each payment frequency. The one-time one is set up as a simple donation field. The other two options are set up as “subscription” fields.
- Set the Transaction Type to “Donations”
- Select your amount field as the Payment Amount
- Set the Transaction Type to “Subscription”
- Select your amount field as the Recurring Amount
- Set the billing cycle. Like I said, we have one that’s 1 month, and one that’s 1 week. There are also yearly and daily options.
- Set the length of recurrence to how many times you want the subscription to be charged. There’s an option for “infinite” too.
The key to the whole thing is at the end of each feed. There’s a “Conditional logic” section, and this is where the magic happens.
In order for your feed to charge your customers properly, you need to connect the frequency field to the feed. So for the one-time payment, the conditional logic says that the Frequency field must have an answer of “I want to make a one-time offering.”
Similarly, for the monthly option, Frequency must have an answer of “I want to make a monthly offering.”
When set up correctly, it works like a charm.
To set up your Donation form on your WordPress site where you want more than just a simple PayPal button, you need two things:
- Gravity Forms
- The PayPal add-on for Gravity
Then they key pieces to have set up are:
- Product field for the donation amount in the form
- A field to capture payment frequency in the form
- PayPal feeds set up in the PayPal settings for each frequency
- Get your conditional logic correct
Of course, this doesn’t have to only work for a donation form. You can use it for any kind of form where you’re selling stuff. For example, if you didn’t want to use WooCommerce, you could use this pattern to set up a way for someone to purchase downloads from you. You’d set the payment up through the Gravity form, and have the receipt email contain a link to your product.
I’d love to hear of other creative ways you’re collecting payments, donations or otherwise, on your website! Share with us in the comments!