[UPDATE: 04/01/2015 Paypal re-direct revision. Added test form with auto-redirect after form submission.]
[UPDATE: 10/26/2013 Addition of the 'on_set_ok' action handler for the "Additional Settings" section.]
This is a tutorial I wrote to demonstrate how you can add a PayPal button to a WordPress site by integrating it with a contact form.
It works by allowing the visitor submit a form and having the Paypal button appear automatically.
I’ve seen too many websites that offer a service with no request from the user and only a payment. We know you want to get paid for your service, but most likely you need some input from a client. This is how to improve your payment process. (Video tutorial also available)
The requirements are: WordPress, Contact 7 form plug-in, and PayPal.
Here are the steps:
Install and activate the necessary plug-ins. Contact Form 7. Captcha for stopping BOTS and Contact Form to DB Extension are optional, but I strongly recommend them so you can track orders using the database.
1. The activated plug-ins will appear in the left column of the admin page. Click on Contact and create a new form with the “Add New” button.
2. Fill out the form with questions relevant to your service so your prospect feels you understand them from the get-go. SAVE THE FORM. Don’t forget this, because if you navigate to a different page, your changes will be lost.
3. Create your purchase button in PayPal and copy the code (this starts with the <form> tag). Back in WordPress scroll to the section Messages and paste the PayPal button code. Whatever content is here will appear after user clicks the “Send” button. Go to this link https://www.paypal.com/webapps/mpp/merchant-services-hub to create a paypal button.
4. Save the form again or in case you forgot to in step #2. (I usually don’t save when necessary)
5. Highlight and copy the short code after you save the form. It starts with [contact-form-7 404 "Not Found"]
6. Go to the page you intend to have your order button and paste the short code. Save and view that page.
After a user submits the order form, the PayPal button shall APPEAR! Take note of the extra text I added to instruct the user if they don’t Pay their order will not be confirmed.
Alternatively you can add an automatic page re-direct to the Paypal payment page using the action handler ‘on_set_ok’. This uses the
unique id link provided from Paypal and loads that payment page, but it takes a few seconds. Add the following code to the ‘Additional Settings’ section of the Contact Form page as seen in the screenshot. I collapsed several tabs above ‘Additional Settings’ so you can find it easier.
Get the specific parameter string from paypal by accessing merchant services:
Now that you have the entire link, paste in to the Additional Settings box like so:
Here is a functioning form with a re-direct to paypal, just enter your name and type yes:
For more info regarding the additional settings, see the plugin’s documentation http://ideasilo.wordpress.com/2009/05/31/contact-form-7-1-10/ Since it takes a few seconds to load, you should replace the ‘Sent Message’ which I wrote in step 5 to something like “Please wait – You are being re-directed to the payment page.”
Another thing I recommend is adding two pages in WordPress for orders: Payment Completed, and Order Incomplete. These will be good for “user friendliness”. I hate trying to buy something online which takes me to a separate website with no design, because you lose a sense of security and cancel the order. Another reason you will find studies showing “design is important”.
The completed page can notify and assure the “buyer” their order has been started immediately with a order reference number. Whereas the order incomplete page can ask the user for feedback as what would they want improved since they cancelled.