merchant:epaymentform:sameasbilling

Adding a "Same as Billing" Checkbox

This code will allow you to add a box to your form that automatically duplicates the Billing information for use in the Shipping fields. This will save your customers some time while filling out the form.

  1. Log into your USAePay merchant gateway. Go to “Settings”, then “Source Keys”. Select the source key you are using and click “Edit”. Click “Edit Customization to Epay Form”.
  2. Click in the text box, then hit Ctrl-F on your keyboard to search the text. Search for “Shipping Information”. It should take you to a portion of code that looks like:
    1. <tr>
      <td bgcolor="#C4C7D4" width="692" colspan="2"><b><font face="Verdana">Shipping Information:</font></b></td>
      </tr> 
  3. Add the following code to the next line:
    1. <tr>
      <td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Same as Billing:</font></td>
      <td bgcolor="#F0F0F0" width="450">
      <input type="checkbox" name="shipsameasbill" size="28" value="yes" onClick="copyBillingToShipping()"></td>
      </tr> 
  4. Insert a new line and add the following between <script> and </script> tags:
    1. <!--
      function copyBillingToShipping()
      {
       
      var form = document.epayform;
       
      if(form.shipsameasbill.checked)
      {
       
       form.UMshipcompany.value=form.UMbillcompany.value;
       form.UMshipfname.value=form.UMbillfname.value;
       form.UMshiplname.value=form.UMbilllname.value;
       form.UMshipcompany.value=form.UMbillcompany.value;
       form.UMshipstreet.value=form.UMbillstreet.value;
       form.UMshipstreet2.value=form.UMbillstreet2.value;
       form.UMshipcity.value=form.UMbillcity.value;
       form.UMshipstate.value=form.UMbillstate.value;
       form.UMshipzip.value=form.UMbillzip.value;
       form.UMshipcountry.value=form.UMbillcountry.value;
       form.UMshipphone.value=form.UMbillphone.value;
       
      }
      }
      //-->
  5. Save the changes to your form. This will create a checkbox on your payment form that looks like this:


Once you have saved changes to your payment form, you will be able to instantly fill out the Shipping fields with Billing information.

merchant/epaymentform/sameasbilling.txt · Last modified: 2010/03/16 11:53 by hmcgowan

Page Tools