Sometimes churches and organizations need to use a sign up form for an upcoming event, but aren’t exactly sure how to integrate PayPal with their favorite WordPress form plugin so they can take payments along with registrations. I’m a huge fan of Gravity Forms, but there is no built in support for PayPal as of yet, so here’s how I use it along with PayPal for event registrations. If you have another favorite form plugin, please feel free use it instead.
First we need to set up our button with PayPal. You can do this by going to your PayPal account and selecting merchant services as in the picture above or you can use the code below as a template for your button. This code is set to work around your PayPal email address which can have its advantages if you are unable to use the protected version for some reason or another. I’m including this code in a fund-raising section of a new theme I’m developing for non-profits called Agency.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_xclick" />
<input name="business" type="hidden" value="firstname.lastname@example.org" />
<input name="return" type="hidden" value="n=http://www.yoursite.com/registration-paid" />
<input name="item_name" type="hidden" value="Registration Fee" />
<input name="amount" type="hidden" value="20" />
<a href="https://email@example.com&currency_code=USD&amount=20&return=http://www.yoursite.com/registration-paid&item_name=Registration+Fee" target="paypal">Pay and register here.</a>
Here’s a quick run down of what to change in the code. In the second input line, use your email address that is registered with PayPal. The third input line has a very important field, the return URL after someone has completed payment. This is where we will place our registration form. The Fourth input has the name of the item that will be displayed at PayPal.com when someone is paying. The last one is the amount that they will be charged. The last bit of the form is a link that also contains copies of these elements that we’re sending to PayPal.
Once you have your button created, then you will need to insert it into the page or post where you want people to start the registration process. Since all they will see is a text link, you can place this just about anywhere. You could easily include it into a text widget so it could be on every page or post in your site with minimal effort.
Now that your payment link is set, you need to create the page or post where the registration form will go. First we create a new form in Gravity Forms using their visual editor to quickly add the fields we need like name, address, phone number, email address plus anything we need for the registration like a spot for special requests or comments. Once we have the form set up, we go to the page or post where we’d like to use this form and insert it there. One thing we will want to take care of is to make the URL not easily guessed. We don’t want people accessing this page or post without first going through PayPal. You can change the “slug” or the end of the URL by clicking just below the title of any WordPress page or post and entering pretty much anything you want. You can shoot for a series of letters and numbers to make it difficult to randomly guess. Just make sure you place this URL into your purchase button and you’ll be set.
So now we have a purchase link that when clicked, takes someone registering to PayPal to pay for the event, and upon successfully paying, they are returned to our registration form where we can collect their information. It’s that easy. I would suggest checking the registrations against the collected payments just to make sure no one slipped through without paying, but you should be pretty secure.
If you’ve found any helpful methods to use your contact form, share them with us in the comments.