There are WordPress plugins which add the functionality of collecting payments using the Contact Form 7 forms. However, you do not need to spend money on purchasing these additional WordPress plugins to add PayPal payment option to Contact Form 7. Using the steps outlined below, you can easily add a PayPal payment option to Contact Form 7 form you have created.
Why Add PayPal Payment Option to Contact Form 7?
With Woo Commerce plugin for WordPress, you can easily build an e-commerce site or sell product/services on your existing WordPress site. Woo Commerce comes with PayPal support and you would ask why do I need to use Contact Form to collect payment when I can create a product in Woo Commerce and sell it?
Well, the answer is simple. There are times when you need a payment option with a registration form. As was the case with one of my customer, a reputed school in Canada required that the students make online payments through PayPal after completing a registration form online.
Integrate PayPal with Contact Form 7
- Install the Contact Form 7 plugin if you haven’t already. From the life side option in WordPress Admin, click on Contact and create a new form with the “Add New” button.
- You can refer to the official plugin website on how to create a Contact Form 7 form.
- I’m creating a simple donation form which asks for Name, Email, and Country.
- Save the form and login to your PayPal business account.
- Navigate to “All Tools” under “Tools” and select “PayPal Buttons“.
- Create your PayPal “Buy Now” Button. Add the URL which you want the customer to be redirected to after making the payment or canceling the payment.
- Save the button to get the HTML code to be used on Websites/Email. Move to “Email” tab and copy the code and paste the code below:
on_sent_ok:"location.replace('PASTE YOUR EMAIL COPIED CODE HERE');"
- In the Contact Form 7, navigate to the Additional Settings tab and enter the above code.
- Your contact form with PayPal payment is ready.
- Optional 1: You can add security to your form and stop spam by activation reCaptcha for Contact Form 7.
- Optional 2: Although you will receive an email when the form is submitted, you can also save the form fields in DB using Contact Form to DB Extension.