There are times when you will want your clients to read and accept terms and conditions before making a payment in PayPal. The great thing about the following approach is that it will work for just about any website, whether the site is simply written in HTML or uses a CMS like WordPress, Joomla or Drupal.
Here is how to add a checkbox to your PayPal button.
STEP 1 -- Add the following Javascript code on your page:
<script type="text/javascript"> // <![CDATA[
function confSubmit() {
if(!document.getElementById("accept").checked) {
alert("Please read and accept the Terms and Conditions in order to continue.");
return false;
}
} // ]]></script>
STEP 2 -- Replace the following piece of code in the PayPal form created by the PayPal button generator:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
…with…
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return confSubmit();">
STEP 3 -- Insert the following code just before the line that starts with <input type="image" name="submit" …:
Option 3A -- Terms and Conditions on the Same page:
<p><input id="accept" type="checkbox"> I have read and agree to the Terms and Conditions</p>
Option 3B -- Terms and Conditions on a Different page:
If the Terms and Conditions are on a separate page, turn the text into a link. For example:
<p><input id="accept" type="checkbox"><a href="terms-and-conditions/" target="_blank">I have read and agree to the Terms and Conditions</a></p>
That's it. As a result of these changes, a new check box will appear right above the PayPal button. If the customer clicks the button without checking the box, the button will not work and a message will be displayed.
Note: Should the JavaScript be disabled, the checkbox will have no effect and the client will be able to proceed with the transaction regardless of whether the checkbox is checked or not.
November 27, 2012 at 9:03 PM
Thanks a lot for this! You rock!
January 15, 2013 at 9:41 PM
Hello,
I am trying to add the “terms and conditions” function to my site in which they have to accept before they make a paypal payment.
I have no idea in regards to coding, i just know how to enter the HTML onto my website and so far have the check box for terms nad conditions and the paypal button but i want to know if there is anyway in entering my actual terms and conditions into the html coding or there has to be a link to a seperate page.
Please advise, thank you.
Anastasia
March 1, 2017 at 11:12 PM
I have the same question, did you got your answer ?
March 2, 2017 at 1:09 PM
Hi Yaseen, though a little late, I just posted a reply to Anastasia’s question. Hope you find it useful.
March 2, 2017 at 1:08 PM
You have several options:
Solution 1: The easiest is to create a separate page with the terms and conditions and then have the link take you there in a new tab or window.
Advantage: This centralizes the terms and conditions on your site. If you need to up date them, you need just make changes in one place.
Disadvantage: Some people might not realize that they are in a new window and not know how to get back.
Solution 2: You could simply include the terms and conditions text right in the page and remove the link from the text next to the checkbox. This is pretty easy to do as well. Another related solution is to use something called a “lightbox”. This would display the terms and conditions content in a popup box instead of taking up space on your page. This solution requires some coding in order to implement. You sometimes see these on websites where you click on an image and a larger version opens up but there is no reason it needs to be an image. Text can work well in these boxes too.
Advantage: This solution is especially useful if you only need to do this on one or two pages on your site and have a very short blurb describing the terms and conditions. Visitors to your site will be able to see the text without leaving the page.
Disadvantage: When you decide you need to update the terms and conditions in the future, you will need to find every page on your website where they exist and update them all. Having the terms and conditions right in your web page can also make your web page look cluttered.
One way around this last problem is to use a tag substitution system, also known as global content blocks. It goes by different names depending on the software that runs your website. For example, in WordPress they are called ShortCodes. On a WordPress site, you would start by installing a plugin like https://wordpress.org/plugins/reusable-text-blocks/ . Then you would create a new tag and enter your Terms and Conditions statement. Upon saving it, the plugin will give you a shortcode tag that will will look something like this: [text-blocks id=”1″]”. Then you need just copy and paste this into any page on your website where you would like the Terms and Conditions to appear. When people view the page, they will see the text associated with the shortcode instead of the tag itself. That way, if you ever need to update your terms and conditions, you will just need to go back to the reusable text block and edit the text. The content will be automatically updated throughout your website.
Hope you find something in all of this useful.
Best regards,
Michael
December 3, 2013 at 12:28 PM
This worked splendidly! Thanks for the tip!
December 5, 2013 at 3:51 AM
Thank you so much. Works wonderfully. Great easy to follow instructions
February 13, 2014 at 7:19 AM
This was a simple solution, to bad i am not to good with javascripts.
Thank you!
March 21, 2014 at 8:27 AM
Genius, thanks.
I’m having a problem with this solution when using two separate payment buttons on the same page.
Both correctly display the checkbox and “Please agree to the T&Cs”.
The button on the left works fine.
The button on the RIGHT requires the checkbox fof the LEFT button to be checked, before proceeding to Paypal.
Any idea how I might fix this?
Thanks a lot,
Jesse
March 17, 2016 at 1:37 AM
I am having this same issue, did you ever a solution? I have 4 buttons and the left most check box works but the 3 to the right do not. Thanks for any advice you may have.
March 25, 2016 at 4:54 PM
Sorry Damien. Haven’t worked with it since. I am available if you want to hire me though! 🙂
February 9, 2015 at 4:35 PM
Thank you, it has worked well. However, I noticed on an ipad that customers are not forced to check the box before purchasing. They have to check the checkbox on a desktop to be able to pruchase.
May 1, 2015 at 7:47 PM
This worked great with one button, but when I try to use it for three paypal buttons on the same page, none of the buttons work. Do you have a workaround for this? Much appreciate the help!!
May 3, 2015 at 2:36 PM
Hi Jason,
Thanks for the great question. Unfortunately the code was written to only work with one checkbox per page. It would have to be re-written to support multiple “Accept” checkboxes.
That said, I think it would still work if you put one checkbox in its own <form> for the whole page. The code only checks the checkbox and couldn’t care less where it is located. Something like (Step 3a version):
Just remember to remove the line from each of your PayPal buttons and, of course, only include the JavaScript from Step 1 once for the whole page.
Hope that helps!
Best regards,
Michael
May 4, 2015 at 12:53 AM
Hi Michael,
Thanks for the reply. That didn’t seem to resolve the issue. Any other thoughts? Again, much appreciate the help!
Jason
May 11, 2015 at 6:26 PM
Hi Michael,
that’s exactly the code I was looking for, thank you so much! One problem, though, it seems to work only with Chrome. With IE and Firefox it doesn’t work. Do you have any idea why that is? I wonder if I’m the only one, who’s experiencing that kind of problem.
Thank you for your efforts!
Best wishes,
Stephanie
May 11, 2015 at 6:47 PM
Hi Michael,
it works! I don’t know why, but I’m happy it does! 🙂 Maybe it was the cache.
Thanks again,
Stephanie
July 8, 2015 at 5:12 PM
I’ve tried to add the Terms and Condition checkbox and the paypal button for the this website. The customers will need to check the box before proceeding to checkout, but it’s allowing me to proceed without checking the box. I can’t figure out where my code is wrong. Can you help, please?
July 29, 2015 at 12:13 AM
Hi Rachel,
There are many potential reasons why this might be happening and I could guess for a very long time at what the solution might be. Contact me if you would like to hire me to fix this up for you.
Best regards,
Michael
July 29, 2015 at 11:41 AM
Thanks a lot, you save me a lot of time!
August 27, 2015 at 5:31 PM
Such an elegant solution. Thank you!
September 3, 2015 at 7:03 PM
You are very welcome Kathryn. I am grateful to hear it helped you out.
Best regards,
Michael
December 11, 2015 at 10:49 PM
What an elegant solution! Thank you so much.
I’m having one issue. It works great except when I use it with pricing options. When options are embedded in a table form, it can’t tell that I’ve checked the box. example: http://www.alignedfitness.today/packages.html, the build your own month packages towards the bottom. Can you help with this? I’m not well versed in javascript and don’t know how to fix this.
February 7, 2016 at 4:56 PM
Hi Georgia,
That would require some customization. Contact me through the Let me through the “Contact me” link above if you would like to hire me to fix it up for you.
Best regards,
Michael
January 18, 2016 at 2:13 AM
Your html code is a godsend! Thank you! 😉
March 29, 2018 at 6:21 PM
Hi, i’m certain I have included your code correctly on one page and the checkbox is there but i’m having the same problem as Rachel- rachel on July 8, 2015 at 5:12 pm.
What will you charge to help me fix this problem please?
April 17, 2019 at 6:27 PM
Hello,
I have added this to my site but people are still able to continue to PayPal without clicking the terms button. Can you tell me what I may have done wrong?
Click on Waban village day and then family fun run registration and you will see the terms checkbox and how you can bypass it.
Thank you,
Jennifer
November 6, 2019 at 1:00 PM
Hi Jennifer, hope the fix I provided helped contribute to the success of your event.
Best regards,
Michael
December 28, 2019 at 11:08 AM
Hello, I have a question in regards to HTML code for the paypal button. I have an online medical clinic that the hours of operation are say 9am-7pm mon-sat is there a way to disable the paypal button for times outside the hours of operation? Thanks all help is appreciated.
Mike
January 3, 2020 at 10:45 PM
Hi Mike,
Here is a link to a snippet of code demonstrating how to enable and disable a button during certain hours of the day:
https://stackoverflow.com/questions/21001143/js-enable-button-during-a-certain-period-of-time-in-a-day#answer-21001332
Naturally you would replace the ‘checktime’ in getElementById(‘checktime’) to the id of your paypal button.
What is really nice about this particular code is that the button will automatically enable/disable itself during certain hours even if the visitor doesn’t refresh the page. So for example, even if they load the page at 6:59 PM, the button will automatically become disabled at 7:00 PM. With just a little more code, you could also have it check for the day of the week. Note that, if you observe DST (daylight savings time) in your area, you will need to remember to modify the code twice a year or add a little more JavaScript to account for that too.
Instead of disabling the button, another approach to this might be to have a message pop-up if they try to click it outside of normal business hours. The message would let them know that this is only available during normal office hours. Even better might be to remove the button during certain hours and display a message instead.
Need help coding it to your specific requirements? My services are available by sending me a message through the form at https://www.tngconsulting.ca/contact/
Hope you find this helpful.
Best regards,
Michael Milette
July 14, 2020 at 7:58 PM
Thank you for this. Worked like a charm. Super easy to follow!
January 31, 2021 at 12:39 PM
Great bit of code AND instructions – Thanks for sharing your knowledge!
KJ
August 26, 2022 at 8:38 PM
Hi, I have a Wix website and need this workaround, but have no coding experience and would like to hire you for the update. Thank you
November 6, 2023 at 11:11 AM
Please contact me at https://www.tngconsulting.ca/contact.
February 15, 2023 at 7:10 AM
Do you have a similar solution for a paypal smart button?
August 21, 2023 at 11:53 PM
Sorry, I do not.