You can easily direct users from your contact form to PayPal.com when the user/customer clicks the submit button. Such cases arise when you have an online business where the customer has to provide details about the order. I was in a similar situation in the past 2-3 days when I was adding functionalities to my design website where I provide Logo Design Services.
The best is that the users/customers can make payments via their credit card as well. For that you will have to create Paypal payments links which you will use in your contact form 7 additional settings.
What do you need to Integrate Paypal payments with your contact form?
- Paypal Payments links – This link will take you to Paypal button designer page
- Contact Form 7 Plugin for WordPress
There are premium premium plugins out there but in my opinion if you can get everything for free then why waste money ? Just a simple line of code will do the trick for you.
How to Create Paypal Payment Links or Buttons ?
- Visit Paypal Button Designer page and create a button as per your requirements
- Once you create the button, you will get the button code. Please select email instead of button on the tabbed widget
- Copy and save the link in a notepad

Installing Contact Form 7
- Learn how to install and use contact form 7 by watching this video http://www.youtube.com/watch?v=jPVDfjeyvfI
- Go to contact form settings in your WordPress dashboard
- Add a new form and design it as per your requirements
- Scroll down to Additional Settings
- Add the below code and save changes
- on_sent_ok: “location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PUT YOUR BUTTON ID HERE‘;”
If the above code doesn’t work, Please try this one.
- on_sent_ok:"location.replace('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Enter_Your_Buy_Now_ButtonID_here');"

- Now whenever a user clicks on the submit or send button, It will direct them to Paypal for making payments.
You can also watch my video tutorial :
I hope this tutorial was easy and simple to understand. I would appreciate if you comment below. Thanks a lot for your time and patience.




Hi,
I followed the steps as stated in your tutorial. But my form never gets redirected to the paypal website after I clicked the submit button. The page didn’t even show the message to say that the message has been sent succcessfully. However the form was indeed submitted.
Any advice will be most appreciated!
Thanks!
It just works fine for me.
on_sent_ok:”location.replace(‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=add_your_button_id_here’);”
Hi again,
I just found out that using location function works and not location.replace.
Unfortunately neither one seems to works for me. I tried the replace and then with function. Any updates ?
las comillas que estas usando no son las que corresponden!!!!
este código me sirvió:
on_sent_ok: “location = ‘http://example.com/’;”
It didn’t work, so I tried the url from Heidi E Hafner: on_sent_ok: “location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=[PUT YOUR BUTTON ID HERE]’;”
and It works
Thanks, I will update the article
Looks interesting, definitely worst try. I am going to try this for sure.
Thanks for sharing useful article.
Go ahead 🙂
Hi there,
I am building a website for my old man as a gift to help him with his business.
I’m using CF7 to place an order for 1 of 4 items available which I have set up individual paypal buttons for.
Below is the code I put into the ‘Additional Settings’ Field at the bottom of the editing page for my CF7 form within the dashboard.
I need the form to redirect to each of the 4 respective items dependant on the number in the spinbox which has only 1 – 4 available.
‘number-426’ is a number field spinbox which is tag: [number-426] on my CF7 Form editing page and the hosted button id’s are just dummies as I don’t want to give the real ones to all readers.
on_sent_ok: “if (document.getElementById(‘number-426′).value==’1’) {
location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ABC’;
} else if (document.getElementById(‘number-426′).value==’2’) {
location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ABCD’;
} else if (document.getElementById(‘number-426′).value==’3’) {
location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ABCDE’;
} else {
location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ABCDEFG’;
}”
I’ve been at this for hours and would be very grateful if anyone could shed some light on why it isn’t working and how to make it do so.
Thanks heaps in advance 🙂
I made a plugin that does exactly this: https://wordpress.org/plugins/contact-form-7-paypal-add-on/
That is awesome Scott. Could you email me? anish(@)bleepingtech(dot)com
Hi,
How do you get the email option with Paypal?
Hi Ben,
After you login to your paypal account visit this link https://www.paypal.com/in/cgi-bin/webscr?cmd=_singleitem-intro-outside
then click on create button now, fill in the details and click on create button. In the next screen, select email instead of website.