I am going to show you how we can manually integrate Paypal with Contact Form 7. Ready? Let’s Go.
So the reason I need to add PayPal with Contact form 7 is one of my client requesting me if it is possible to have a payment method on one of his form. So I checked his site and saw that he is using a Contact Form 7. I know there are lots of form builder for WordPress that integrate PayPal but I need something that is for free to use.
Creating a form using Contact Form 7
Lets say you have installed Contact form 7 in your WP site (if not just go to your plugin section and add new plugin then search contact form 7).
lets go create a new form and replace this.
<p> [text* your-name placeholder "Name"] </p>
<p> [email* your-email placeholder "Email"] </p>
<p> [tel* tel-555 placeholder "Phone"]</p>
<p>[select menu-245 include_blank "Payment 1|25" "Payment 2|30"]</p>
<p> [textarea your-message placeholder "Message"] </p>
Now that we have a form. As you can see I added a drop down menu to select which payment did we want, for example I added $25 for Payment 1 and $30 for Payment 2. You can add much more if you have drop down that you want to choose from them.
okay to insert the contact form into your page, copy the shortcode and paste it into the page content you want it to display.
The shortcode will look like this.
[contact-form-7 id="1234567" title="Example Contact form"]
Lets preview it so we can see how does our form looks like. You can style it base on your WP theme.
Paypal Integration to CF7
When you scroll down in your form setting you will see a field where it say “Sender’s message was sent successfully”
we will replace it with our custom code below.
<h2> Upon confirmation you will be redirected to PayPal. </h2>
<p>Type of Party:</label> [_raw_payment-type]</p>
<p>Amount: $ [payment-type]</p>
<a href="https://www.paypal.com/cgi-bin/webscr?business=Add-your-Paypal-Email&cmd=_xclick¤cy_code=USD&amount=[party-type]&item_name=[_raw_payment-type]" class="submit payment-submit">Continue to Payment</a></div>
it will now look like this.
The explanation of above code is easy and default the only tricky part there is the drop down payment option I use.
I use what so called pipe use by Contact form 7. You can read how to use it on their blog click here.
If you have any questions or comments just post it below.