Re: Add terms and conditions to my Paypal checkout

Daniels118
Contributor
Contributor

If your button is generated by javascript you may add a transparent cover to intercept and block click events until the user accept the terms.

 

HTML

 

<div id="paypalButtonWrapper">
  <div id="paypal-button"></div>
  <div id="paypalButtonCover"></div>
</div>
<div id="paypal-accept">
  <input type="checkbox" id="paypalAccept"/>
  <label for="paypalAccept">I accept terms and conditions</label>
</div>

 

CSS

 

#paypalButtonWrapper {
  position: relative;
}

#paypalButtonCover {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  cursor: pointer;
}

 

Javascript

The following code uses jQuery, but it can be easily converted to pure js (this is left as an exercise):

 

$('#paypalButtonCover').click(function(e) {
  alert("Please accept terms and conditions");
});
$('#paypalAccept').change(function() {
  if ($(this).is(':checked')) {
    $('#paypalButtonCover').hide();
  } else {
    $('#paypalButtonCover').show();
  }
});

 

 

Regards

Login to Me Too
1 REPLY 1

Lydi229
Contributor
Contributor

This is exactly what I need to do but I don't know how to put this information in my smart button code?  Do you have an example of how the full smart button code would look like with the code provided on this page? 

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.