Table of Contents

ePayment Form v2.13.0

Overview

The payment form allows a merchant to send the customer to USAePay for the collection of secure payment information. This eliminates the need for individual merchants to maintain their own SSL certificates. To implement the payment form, the merchant's website needs to redirect the customer to a specially formatted URL, display a form that will post to the USA ePay site, or display a button that's connected to the form. Before creating the URL/form/button please see the sources section in order to setup the source key within the USAePay Merchant Console. You will need the source key to connect to the gateway.

Creating a Buy Now Button on your website

  1. Things to know:
    1. This section teaches you how to place a button image on a web page of your website which links to USAePay's secure Payment Form for collection of funds. You will need access to edit your own website and be able to upload an image to your website via a service such as FTP or something similar. Most companies that host your website have a tool that will allow you to upload files. Please check their documentation before proceeding.
  2. Collecting the pieces:
    1. You will need to have an image that appears to look like a button. If you do not wish to create one you can use one of several USAePay pre-built buttons available here.
    2. In order to create the link you will need to use a text editor or your favorite editor such as Notepad, TextEdit, Dreamweaver, etc.
    3. Almost no HTML knowledge is required as most of the pieces are here for you to put together. However it does help to know several HTML tags, specifically the anchor tag <a href=””></> and the image tag <img src=””/>. You will be using these.
    4. The most important part is having your source key ready. For information on how to generate it please visit here. Once you have it be ready to copy and paste.
  3. Putting it together
    1. Open your favorite web page editor as specified above in “Collecting the pieces”.
    2. Begin with typing the image tag and it's associated attributes namely the src which is the source of the button image (where it comes from) and the alt which is the text displayed when a curser is hovered over the image: <img src=“usaepaysecurebuttongray3.gif” alt=“Click to pay” />
      1. As you can tell the source of our button is an image called “usaepaysecurebuttongray3.gif”. You can use your own image. For this example our stock button image is used. It looks like this: The path of the images is the same as the web page that image will be on. If you have your images in a directory called “images” for example, the link will be “src=“images/usaepaysecurebuttongray3.gif”. The alt attribute has the text “Click to Pay”. This is optional as well is customizable to anything you want.
    3. Now wrap the image tag with an anchor tag <a href=””>IMAGE TAG GOES HERE</> to make it look like this:
      <a href="https://www.usaepay.com/interface/epayform/_YOUR_SOURCE_KEY_HERE_/sale?&UMamount=10.00&UMinvoice=123456&
      UMdescription=Thank%20You%20For%20Your%20Payment"><img src="usaepaysecurebuttongray3.gif" alt="Click to pay" />
      </a>
    4. There is only one attribute that was populated within the anchor tag, the href. This is the URL that will be requested when the button is clicked. It needs to be specially formatted to connect to USAePay, authenticate you as a valid merchant on our system and pass in the required information to make a payment. Let's break it down:
      1. There are several parts that make up the URL and they are all concatenated (attached) but the ampersand character ”&”.
      2. The first part is the Payment Form URL on USAePay's servers: https://www.usaepay.com/interface/epayform/_YOUR_SOURCE_KEY_HERE_/sale?. The only thing that you need to edit here is the source key. As you can see there is a dummy key placed for security. You will need to remove it and paste your own source key after “epayform/” and before ”/sale?”. The “sale?” command tells USAePay this is a credit card charge. Your option is “authonly?” to authorize payment only.
      3. After that you will see an ampersand, ”&”, to concatenate the amount of your transaction. This is done by attaching UMamount (all fields are case sensitive) and equaling it to the dollar amount including the cents separated by a decimal point. This piece will be UMamount=10.00
      4. Once again after adding another ampersand, ”&”, the invoice of the order is attached. This piece will be UMinvoice=123456. It is highly recommended that you pass in this value. It designates the invoice or order number of your transaction.
      5. The final piece is the description of your transaction. After adding the last ampersand, ”&”, type UMdescription setting it equal to the actual text description. If there are spaces in your description as there are in this example they need to be separated by ”%20”. This is the code that browsers use instead of space because URL's by nature do not have spaces. This piece will be UMdescription=Thank%20You%20For%20Your%20Payment
      6. Close the first part of the href tag with a greater than carrot symbol ”>” and close the entire tag AFTER the image tag with a ”</a>”
      7. You should now have a complete link as in section 3.III.
      8. An HTML page with the example and button is available for you here to download. Don't forget to place YOUR own source key inside the code.
  4. Testing the Buy Now Link
    1. Save the file with the .html extention or unzip the file from our example. Open your favorite browser and locate the file→open menu and find the file you saved or unziped. Open it. You should now see the button and you should be able to click it. If you see a broken image make sure the button image is located at the same place as the files you saved such as the Desktop. Click the button and if everything is correct it will lead you to your secure Payment Form on USAePay's servers. Don't forget to place YOUR source key in the code. The Order Summary block should be filled out completely. If not make sure you're passing the UMamount, UMinvoice, and UMdescription correctly along with the values in quotes. The fields are case sensitive.
    2. Checklist:
      1. Can you open your own file?
      2. When the file is open do you see the button image?
      3. Is the button image clickable?
      4. When you click on an image does it lead you to YOUR secure Payment Form hosted by USAePay?
      5. Does the Order Summary block contain all the information and none of it is blank including the Order Date, Order Amount, Order Number, Customer IP, and Description? It should look like this:
      6. If all of the following are yes then you are ready to make it live.
  5. Making it live
    1. If you have a designated web page on your website that will need the button then edit the web page, place the code somewhere within the <body> tag of the page, save it, and upload it to your website. Also upload the button image to the same place or wherever your images are located on your website file structure. You should now be able to browse your website to that specific page and see the button. Make sure to refresh the page if you don't see the button appear. Go down the checklist in section 4.II starting with c-f.
  6. Further reading
    1. How to customize the form on USAePay's end: here
    2. Where to generate the source key from your account: here
    3. Where are more buttons that USAePay already pre-built: here
    4. More on the anchor tag
    5. More on the image tag
    6. Basic HTML tutorial
    7. Basic FTP tutorial

Payment Form URL

If you need to provide your customers with a link that directs them to our secure ePayment form the customer can click on a direct link, or the merchant's site can redirect the customer to a URL in the following format:

https://www.usaepay.com/interface/epayform/[key]/[command]?UMamount=[amount]&UMinvoice=[invoice]&UMmd5hash=[hash]

Where [key] is the source key copied from the sources screen, [command] is either sale, credit or authonly, [amount] is the total monetary amount of the transaction, [invoice] is the invoice or order number and [hash] is the md5hash pin (See Source Pin Code). Pin and hash are optional.

Example Links

Using the Payment Form

Payment Form via POST

The customer can also post data directly to the payment form. The merchant's website would just need to present the customer with an HTML page containing the following form:

<form action="https://www.usaepay.com/interface/epayform/">
<input type="hidden" name="UMkey" value="[key]">
<input type="hidden" name="UMcommand" value="sale">
<input type="hidden" name="UMamount" value="[amount]">
<input type="hidden" name="UMinvoice" value="[invoice]">
<input type="hidden" name="UMhash" value="[hash]">
<input type="submit" value="Continue to Payment Form">
</form>

Any of the form fields, will be managed by the API. If you create a custom payment form, you must make sure to include a hidden form field for any field you wish to pass through to the API.

If the amount will not be fixed, but will instead be entered manually by the merchant, change the input type from “hidden” to “text” as shown below:

<form action="https://www.usaepay.com/interface/epayform/">
<input type="hidden" name="UMkey" value="[key]">
<input type="hidden" name="UMcommand" value="sale">
<input type="text" name="UMamount" value="[amount]">
<input type="hidden" name="UMinvoice" value="[invoice]">
<input type="hidden" name="UMhash" value="[hash]">
<input type="submit" value="Continue to Payment Form">
</form>

Case Study: Donation Form

The following is a case study for creating a simple donation page hosted on your website that connects to USAePay for secure processing. This is a great starting off point for religious donations, non-profit organizations, or any merchant accepting a variable dollar amount from the client through a payment form. Below you can download the necessary source code files. Edit the HTML source code with your favorite editor (Notepad, TextEdit, Dreamweaver) to input your source key and edit any of the templated text already there for you. Save the files in the original format. These files will need to be uploaded via a service such as FTP, or something similar, to your website. Once you've uploaded the files you can access them through the browser. Clicking on the button submits the form to USAePay and brings the customer to the secure payment area on USAePay's servers. The customer completes the payment process by entering their payment information. For information on editing USAePay's hosted paymet form click here.

Download zip with HTML source (XHTML 1.0 Transitional) and button image

- Source Code

- More buttons available here

ePayment Form fields used

The form uses the following fields to post to USAePay:

-UMkey - This is the source key that connects you as a valid merchant on our gateway (Required)

-UMcommand - This indicates the type of a transaction, sale. (Required)

-UMinvoice - This allows you to pass a numerical invoice number for record keeping. (Required)

-UMamount - A text box displayed for customer to enter a decimal (0.00) amount. (Required)

-UMdescription - A text box for any comments left by the donor

-UMcustemail - A place for the donor to enter their email address for a confirmation receipt.

The form is not limited to only these fields. Others may be used. Please customize based on your preferences.

HTML Source for Donation form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
 
<style type="text/css">
 
/*<![CDATA[*/
 div.c6 {text-align: center}
 p.c5 {text-align: center}
 span.c4 {font-family: Verdana; font-size: 80%}
 span.c3 {font-family: Verdana}
 span.c2 {color: #FFFFFF; font-family: Verdana, Arial; font-size: 120%}
 span.c1 {color: #FFFFFF; font-family: Verdana, Arial; font-size: 200%}
/*]]>*/
</style>
</head>
<body>
<form action="https://www.usaepay.com/interface/epayform/">
<input type="hidden" name="UMkey" value="HBDy1XU40KsourceKeyHere7a5iOh2HP" /> 
<input type="hidden" name="UMcommand" value="sale" /> 
<input type="hidden" name="UMinvoice" value="[invoice]" />
<input type="hidden" name="UMcustreceipt" value="yes" />
<div class="c6">
<table border="0" width="700" cellpadding="4" cellspacing="0">
<tr>
<td bgcolor="#9999FF" width="692" colspan="2"><strong><span class="c1">Donate for a cause</span> <span class="c2"><br />
Money For Charity</span></strong></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="692" colspan="2"> </td>
</tr>
<tr>
<td bgcolor="#C4C7D4" width="692" colspan="2"><span class="c3"><strong>Donor Information:</strong></span></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234">         </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Donation Amount:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMamount" value="[Amout Here 00.00]" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234">         </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Comments:</span></td>
<td bgcolor="#F0F0F0" width="450">
<textarea name="UMdescription" cols="40" rows="5">
Enter your comments here...
</textarea>
<br /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234">         </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Email Address:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMcustemail" size="20" value="[Your email address here]" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="692" colspan="2"><span class="c4">     </span></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234"> </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234">         </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="692" colspan="2">
<p class="c5"><input type="image" src="usaepaysecurebuttongray3.gif" value="Continue to Payment Form" /></p>
<hr /></td>
</tr>
</table>
</div>
</form>
</body>
</html>

Case Study: Recurring Subscription Form

The following is a case study for creating a simple recurring or subscription page hosted on your website that connects to USAePay for secure processing. This is a great starting off point for service fee merchants that want to accept a variable or fixed dollar amount from the client through a payment form. Below you can download the necessary source code files. Edit the HTML source code with your favorite editor (Notepad, TextEdit, Dreamweaver) to input your source key and edit any of the templated text already there for you. Save the files in the original format. These files will need to be uploaded via a service such as FTP, or something similar, to your website. Once you've uploaded the files you can access them through the browser. Clicking on the button submits the form to USAePay and brings the customer to the secure payment area on USAePay's servers. The customer completes the payment process by entering their payment information. For information on editing USAePay's hosted paymet form click here.

Download zip with HTML source (XHTML 1.0 Transitional) and button image

Source Code

- More buttons available here

ePayment Form fields used

The form uses the following fields to post to USAePay:

-UMkey - This is the source key that connects you as a valid merchant on our gateway (Required)

-UMcommand - This indicates the type of a transaction, sale. (Required)

-UMcustreceipt - This flags USAePay to send a customer receipt via email through a value of 'yes'.

-UMrecurring - This flags USAePay to add this transaction as a customer record in Customers & Billing area of the Merchant Console.

-UMinvoice - This allows you to pass a numerical invoice number for record keeping. (Required)

-UMamount - A text box displayed for customer to enter a decimal (0.00) amount. (Required)

-UMbillamount - Sets the monetary amount to charge on each cycle. If this field is left blank the UMamount will be used instead. This is NOT the “initial” charge or “setup” charge, this is only the “recurring” charge. UMamount determines the initial charge.

-UMschedule - Determines the recurring billing schedule. Possible values are daily, weekly, biweekly, monthly, bimonthly, quarterly, biannually, or annually. (defaults to monthly)

-UMnumleft - Number of transactions remaining in recurring billing cycle. If the recurring billing should go on indefinitely, set this to *. (defaults to *)

-UMstart - Start date. Default is tomorrow. Must be entered in YYYYMMDD format. If set to UMstart=next the date of the next billing cycle will be used. For example if today is 1/10/2009 and UMschedule=monthly then UMstart will be set to 2/10/2009.

-UMdescription - A text box for any comments left by the donor

-UMcomments - Optional transaction comments field. Comments are displayed on the transaction details page.

-UMemail - A place for the donor to enter their email address for a confirmation receipt.

-Billing Fields - All the billing fields that will be transferred over to the secure payment form.

The form is not limited to only these fields. Others may be used. Please customize based on your preferences.

HTML Source for Recurring form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Recurring Payment Form</title>
</head>
 
<body>
 
<style type="text/css">
/*<![CDATA[*/
 div.c6 {text-align: center}
 p.c5 {text-align: center}
 span.c4 {font-family: Verdana; font-size: 80%}
 span.c3 {font-family: Verdana}
 span.c2 {color: #FFFFFF; font-family: Verdana, Arial; font-size: 120%}
 span.c1 {color: #FFFFFF; font-family: Verdana, Arial; font-size: 200%}
/*]]>*/
</style>
</head>
<body>
<form action="https://www.usaepay.com/interface/epayform/">
<input type="hidden" name="UMkey" value="HBDy1XU40KsourceKeyHere7a5iOh2HP" /> 
<input type="hidden" name="UMcommand" value="sale" />
<input type="hidden" name="UMcustreceipt" value="yes" />
<input type="hidden" name="UMrecurring" value="yes"/>
<div class="c6">
<table border="0" width="700" cellpadding="4" cellspacing="0">
<tr>
<td bgcolor="#9999FF" width="692" colspan="2"><strong><span class="c1">Subscribe to a recurring service fee</span></strong></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="692" colspan="2"> </td>
</tr>
<tr>
<td bgcolor="#C4C7D4" width="692" colspan="2"><span class="c3"><strong>Recurring Payment Details:</strong></span></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234">         </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Order Number:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMinvoice" value="12345678" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Initial / Down Payment Amount:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMamount" value="0.00" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Subscription / Recurring Payment Amount (if different from Initial):</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMbillamount" value="" width="250" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Choose your schedule:</span></td>
<td bgcolor="#F0F0F0" width="450"><select name="UMschedule"> <option value="daily">daily</option>
<option value="weekly">weekly</option>
<option value="biweekly">biweekly</option>
<option value="monthly">monthly</option>
<option value="bimonthly">bimonthly</option>
<option value="quarterly">quarterly</option>
<option value="biannually">biannually</option>
<option value="annually">annually</option>
</select></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Number of Payments, "*" means indefinite:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMnumleft" value="*" size="10" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Start Date of Payments (YYYYMMDD format); 
If set to next, date of the next billing cycle will be used. If today is 1/10/2009 and schedule is monthly then start date = 2/10/2009:</span></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMstart" value="next" /></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234"> </td>
<td bgcolor="#F0F0F0" width="450"> </td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Description of Service:</span></td>
<td bgcolor="#F0F0F0" width="450">
<input type="text" name="UMdescription" value="Service Fee">
</td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><span class="c4">Comments:</span></td>
<td bgcolor="#F0F0F0" width="450">
<textarea name="UMcomments" cols="40" rows="5">
Enter your comments here...
</textarea>
<br /></td>
</tr>
<tr>
			<td bgcolor="#C4C7D4" width="692" colspan="2"><font face="Verdana"><b>Billing Information:</b></font></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Company Name:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillcompany" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">First Name:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillfname" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Last Name:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbilllname" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Address:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillstreet" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Address Line 2:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillstreet2" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">City:</font></td>
			<td bgcolor="#F0F0F0" width="450">
 
			<input type="text" name="UMbillcity" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">State:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillstate" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Zip:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillzip" size="11" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Country:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillcountry" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Phone Number:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMbillphone" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Email Address:</font></td>
			<td bgcolor="#F0F0F0" width="450">
			<input type="text" name="UMemail" size="28" value=""></td>
		</tr>
		<tr>
			<td bgcolor="#F0F0F0" width="692" colspan="2"><font face="Verdana" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</font></td>
		</tr>
<tr>
<td bgcolor="#F0F0F0" width="692" colspan="2">
<p class="c5"><input type="image" src="usaepaysecurebuttongray3.gif" value="Continue to Payment Form" /></p>
<hr /></td>
</tr>
</table>
</div>
</form>
</body>
</html>

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.

Adding a Convenience Fee

This code is for adding a flat fee to each transaction that occurs on your payment form. This is not a split payment. For information on split payments, please see Split Payments. The below example assumes you are using the default payment form without any changes.

  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. In the header of the document, add the following code:
    1. <script>
      var servicefee = 5 ;
      function addCharge() 
      {
      var baseamount = document.epayform.baseamount.value ; 
      var total = (baseamount*1) + servicefee ;
      document.epayform.UMamount.value = total ;
      document.getElementById('totalamount').innerHTML = total ;
      }
      </script>
  3. “servicefee” will be the amount that you are adding on to the transaction. Locate the below command in the list of hidden values, and delete it:
    1. <input type="hidden" name="UMamount" value="[UMamount]">
  4. Find the following code in your form:
    1. <tr>
      <td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Order Amount:</font></td>
      <td bgcolor="#F0F0F0" width="450">[UMamount]
      </td>
      </tr>
  5. Replace it with the following:
    1. <tr>
      <td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Payment Amount:</font></td>
      <td bgcolor="#F0F0F0" width="450"><input type="text" name="baseamount" size=10  onChange="addCharge()">
      </td>
      </tr>
      <tr>
      <td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Service Fee ($5):</font></td>
      <td bgcolor="#F0F0F0" width="234"> 5.00
      </td>
      </tr>
      <tr>
      <td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Total Charge:</font></td>
      <td bgcolor="#F0F0F0" width="450"><input type="hidden" name="UMamount" value="[UMamount]"><div id="totalamount"></div>
      </td>
      </tr>
  6. Save the changes to your form. Once the form is saved, the customer will be able to type in the amount they are paying and automatically have a convenience fee added to the transaction total. The customer will not be able to edit the amount of the fee or the grand total of the transaction.

Adding a Convenience Fee as a Percentage (Not a Split Payment)

Follow the above instructions for adding a flat-rate convenience fee to your account, but use the following Javascript:

<script>
 
function doTotal()
 
{
  var form = document.epayform;
  var amount = form.UMcustom1.value = form.UMcustom1.value.replace(/[^0-9\.]/, "");
  var fee = Math.round(amount * .02*100)/100; // Don't forget to change the percentage here
  var total = Math.round(((amount*1)+fee) *100)/100;
 
  form.UMcustom2.value=fee;
  form.UMamount.value=total;
 
  document.getElementByName('UMcustom2').innerHTML = fee; 
  document.getElementByName('UMamount').innerHTML = total;
 
}
</script>

And the following HTML:

<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Payment Amount:</font></td>
<td bgcolor="#F0F0F0" width="450"><input type="text" name="UMcustom1" value="[UMcustom1]" size=10 onChange="doTotal()"></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Service Fee (2%):</font></td> // Change the percentage here as well!
<td bgcolor="#F0F0F0" width="450"><input type=text name="UMcustom2" value="[UMcustom2]" readonly="readonly" onChange="doTotal()"></td>
</tr>
<tr>
<td bgcolor="#F0F0F0" width="234" align="right"><font size="2" face="Verdana">Total Charge:</font></td>
<td bgcolor="#F0F0F0" width="450"><input type=text name="UMamount" value="[UMamount]" readonly="readonly" onChange="doTotal()"></td>
</tr>

Generating a unique invoice number with Javascript

You can generate a unique invoice number with every ePayment Form submisson using a small piece of Javascript code just below the form itself. It's not visible to the payee. You can use it for reporting and searching for specific transactions within your USAePay account. Providing an invoice number with every transaction may also give you a better qualifying transaction rate.

Source Code

<form action="https://www.usaepay.com/interface/epayform/" name="form">
<input type="hidden" name="UMkey" value="3w8Y_SOURCE_KEY_GOES_HERE_zQh76">
<input type="hidden" name="UMcommand" value="sale">
<input type="hidden" name="UMamount" value="10.99">
<input type="hidden" name="UMinvoice" value="">
 
<input type="hidden" name="UMdescription" value="Thank you for your payment">
<input type="submit" value="Continue to Payment Form">
</form>
 
<script language="JavaScript">
var d = new Date();
function f(n) {	return n < 10 ? '0' + n : n; }	
 
var random_num = Math.floor(Math.random() * (99999999999 -  10000000000)) + 10000000000;
random_num = d.getFullYear() + f(d.getMonth()+1) + f(d.getDate()) + random_num; 
document.form.UMinvoice.value = random_num;
</script>

Don't forget!

Add a “name” attribute within the <form> tag itself and set its value to “form”:

 <form action="https://www.usaepay.com/interface/epayform/" name="form">

Add your own source key generated from your USAePay.com merchant console.

What it looks like

The Order Number is the resulting unique invoice number for your transaction.

Download Source Code

The Zip file contains an HTML page with the above code. Just plug in your source key to make it live.

Donwload Here

Developer Reference

Test Mode

Setting UMtestmode to “true” puts the transaction into ”Test Mode”. For more information on what test mode does and credit card numbers to use with test mode, please see the test mode reference page.

Address Verification System

These AVS codes are returned in the UMavsResultCode variable, and serve to provide developers with greater control over the AVS system. Many developers may choose to capture and display the UMavsResult variable instead. The UMavsResult variable contains the meaning of the code, rather than the code itself.

The following is a list of result codes for the Address Verification System (AVS) and what each one indicates. The codes listed in the Code column are the most common responses, but depending on the platform being used, codes listed in the Alternates column may be received.

Code Alternates Meaning
YYY Y, YYA, YYD Address: Match & 5 Digit Zip: Match
NYZ Z Address: No Match & 5 Digit Zip: Match
YNA A, YNY Address: Match & 5 Digit Zip: No Match
NNN N, NN Address: No Match & 5 Digit Zip: No Match
YYX X Address: Match & 9 Digit Zip: Match
NYW W Address: No Match & 9 Digit Zip: Match
XXW Card Number Not On File
XXU Address Information not verified for domestic transaction
XXR R, U, E Retry / System Unavailable
XXS S Service Not Supported
XXE Address Verification Not Allowed For Card Type
XXG G,C,I Global Non-AVS participant
YYG B, M International Address: Match & Zip: Not Compatible
GGG D International Address: Match & Zip: Match
YGG P International Address: No Compatible & Zip: Match

Card ID Result Codes

The following is a list of result codes for the CVV2/CVC2/CID verification system and what each one indicates. These codes are returned in the UMcvv2ResultCode variable and provide developers with greater control over the CVV2 system. Many developers choose to capture and display the UMcvv2Result variable instead. The UMcvv2Result variable contains the meaning of the code rather than the code itself.

The card security codes are 3 or 4 digit codes printed or embossed on Visa, Mastercard, American Express and Discover cards. These codes are also referred to as CVV2, CVC, CSC or CCID. Their purpose is to provide additional protection against fraudulent card use. Below is a list of possible result codes.

Code Meaning
M Match
N No Match
P Not Processed
S Should be on card but not so indicated
U Issuer Not Certified
X No response from association
(blank) No CVV2/CVC data available for transaction.

API Version Number

It is essential that developers pay attention to the version number of the API. The version number is broken up into three positions: compatibility.features.fixes. For example: v2.4.1 The first position (2 in this example) represents the compatibility level. Any application developed with any version 2 of the API will always work with any other revision of version 2. But applications developed with version 3, will not be compatible with version 2.

When a new version of the gateway API is released, the URL will change to keep scripts written on the old version from breaking. The second position (4 in this example) refers to the addition of new fields/features. These features provide additional functionality and are not mandatory. The third position (1 in this example) indicates bug fixes, when nothing structural has changed within the API.

Form Fields

The following is a list of CGI variables that need to be passed to the gateway url. If you are using the client-side method some can be embedded as hidden tags, and others much match your field. An example of a client-side form can be found above.

Note: CC stands for real-time credit card transactions, Checks stands for real-time check processing.

Base Fields

Field Required Description
UMcommand Processing Command. Possible values are: sale, credit, void, creditvoid, authonly, capture, postauth, check and checkcredit. Default is sale.
UMkey x The source key (assigned by the server when you created a source in your virtual terminal).
UMhash If the source key (UMkey) has a pin assigned a validation hash is required (See Source Pin Code section).
UMignoreDuplicate Set to yes if you would like to override the duplicate transaction handling.
UMauthCode x Authorization Code obtained “offline” (ie telephone authorization). Only required for Post Auth.
UMrefNum x The UMrefNum received when a transaction was authorized via either the “sale” or “authonly” commands. Required for void and capture commands.
UMcard CC Credit Card Number with no spaces or dashes.
UMexpir CC Expiration Date in the form of MMYY with no spaces or punctuation.
UMrouting Checks Bank Routing number. Required when UMcommand is set to check or checkcredit.
UMaccount Checks Checking Account Number. Required when UMcommand is set to check or checkcredit.
UMamount x Charge amount without $. This is the grand total including tax, shipping and any discounts.
UMcurrency * Currency of UMamount. Required if using a MCP based account. Must be one of the 3 digit numeric codes found here.
UMtax Portion of above charge amount (UMamount) that is sales tax.
UMnontaxable Set to yes if transaction is not taxable. (optional, platform dependant)
UMtip Portion of charge amount (UMamount) for gratuity (tip).
UMshipping Portion of above charge amount (UMamount) that is for shipping charges.
UMdiscount The amount of any discounts that were applied.
UMsubtotal The amount of the order before tip, shipping, discount and tax were applied. UMsubtotal+UMtip+UMshipping-UMdiscount+UMtax must equal UMamount. If UMsubtotal is not specified, it will be ignored.
UMcustid Unique customer id.
UMinvoice x Unique Invoice or order number. 10 digits
UMorderid Order identifier. This field can be used to reference the order to which this transaction corresponds. This field can contain up to 64 characters and should be used instead of UMinvoice when orderid is longer that 10 digits.
UMponum Purchase Order number. Only required for corporate purchasing cards.
UMticket Obsolete, included for backward compatibility. Use UMinvoice instead
UMdescription Description of transaction.
UMcomments Optional transaction comments field. Comments are displayed on the transaction details page.
UMcvv2 CVV2 data for Visa.
UMcustemail Customer's Email Address.
UMcustreceipt Yes/No. Sends the Customer a Receipt. This overrides the setting for the merchant and source.
UMname x Name on card or checking account.
UMstreet CC Street Address
UMzip CC Zip code
UMdlnum Checks Driver's license number.
UMdlstate Checks Driver's license state of issue.
UMchecknum Checks Check number. (optional)
UMclerk Indicates the clerk/person processing transaction, for reporting purposes. (optional)
UMtranterm Indiactes the terminal used to process transaction, for reporting purposes. (optional)
UMresttable Indicates the restaurant table, for reporting purposes. (optional)
UMip The IP address of the client requesting the transaction. This is used in many of the fraud modules.
UMsoftware Allows application developers to stamp their application name and version number onto each transaction. Used to assist customers with trouble shooting. (optional)
UMredir
UMredirApproved Redirection URL - If the card is approved, redirect to this URL. No fields are passed back. Typically merchants should enable merchant receipts with this option. To enable merchant receipts for a source, see Merchant Email Receipts above.
UMredirDeclined Redirection URL - If the card is not approved, redirect to this URL. No fields are passed back. If UMredirApproved is set but UMredirDeclined is not, the gateway will display the template entered in the sources area. This feature overrides the “Declined Template” feature that is available in the Source Key settings screen. If both are set, the declined template will be ignored and the user will be redirect to the UMredirDeclined url.
UMechofields Echo input fields in response. If UMechofields is set to yes then all fields included in the form (except for the credit card number, key, expiration and cvc) will be included in the redirection URL as GET variables. This is only useful with the client-side method. For example if you post a form with the field “comments” to the gateway and set UMredir to “http://mysite.com/handler.cgi” then the gateway will redirect to http://mysite.com/handler.cgi?comments=… Please Note: Use of this feature is not recommended for security reasons. These fields will typically be logged in your web server log files. On many hosting companies these log files are world-readable which means that anyone would be able to read the information.
UMonError Instructs the gateway what to do when a decline is received when multiple transactions are being processed (see “Split Payments” above). Can be set to Stop, Continue or Void. Defaults to “Stop”
UMtestmode If UMtestmode is set to 1 the gateway will simulate a transaction without actually processing the card. All fraud and verification checks are performed.

Billing and Shipping Address Fields

Billing Address Shipping Address
UMbillfname UMshipfname
UMbilllname UMshiplname
UMbillcompany UMshipcompany
UMbillstreet UMshipstreet
UMbillstreet2 UMshipsreet2
UMbillcity UMshipcity
UMbillstate UMshipstate
UMbillzip UMshipzip
UMbillcountry UMshipcountry
UMbillphone UMshipphone
UMemail
UMfax
UMwebsite

Stored Customers and Recurring Billing

Field Description
UMrecurring If set to yes, the system will enter the transaction as a recurring billing entry once the initial transaction has been approved.
UMbillamount Sets the monetary amount to charge on each cycle. If this field is left blank the UMamount will be used instead. This is NOT the “initial” charge or “setup” charge, this is only the “recurring” charge. UMamount determines the initial charge.
UMschedule Determines the recurring billing schedule. Possible values are daily, weekly, biweekly, monthly, bimonthly, quarterly, biannually, or annually. (defaults to monthly)
UMnumleft Number of transactions remaining in recurring billing cycle. If the recurring billing should go on indefinitely, set this to *. (defaults to *)
UMstart Start date. Default is tomorrow. Must be entered in YYYYMMDD format. If set to UMstart=next the date of the next billing cycle will be used. For example if today is 1/10/2004 and UMschedule=monthly then UMstart will be set to 2/10/2004.
UMcustom[1-20] Optional fields for storing custom data. This data is stored in customer record not the transaction record.

Visa VPAS (Verified By Visa) and UCAF (Mastercard Secure Code) Fields

The following fields are only required in participating in the Verified by Visa or Mastercard Secure Code programs:

Field Description
UMcardauth Set UMcardauth=true to enable cardholder authentication using the integrated gateway authentication system.
UMpares Cardholder authentication payload. (When using integrated authentication system.)
UMxid This field is obsolete.
UMcavv CAVV value received from third part authenticator. If you support CAVV but customer did not participate you must send UMcavv=-1. This flags our system that you support VbV/MC Secure Code. (Only needed if not using the gateway authentication system.)
UMeci ECI value received from third party authenticator. (Only needed if not using the gateway authentication system.)

Card Present Fields

The following fields are only required in a card present environment such as a retail store, restaurant or hotel.

Field Description
UMcardpresent Set UMcardpresent=true to enable card present mode. If UMmagstripe is sent, UMcardpresent will be automatically set to true.
UMmagstripe Mag stripe data read from card. Can include Track 1, Track 2 or both.
UMdukpt DUK/PT key for Pin-Debit transactions. The first 16 characters are the encrypted pin block, followed by the 6 character long Key Set Identifier (KSID). The remaining characters are the Pin Pad serial number and transaction counter.
UMtermtype The type of terminal being used: POS (cash register), StandAlone (self service terminal), Unattended (ie gas pump) Unkown (defaults to Unknown)
UMmagsupport Describes the magstripe reading capabilities of your POS hardware: yes, no, contactless, unknown (default is unknown unless magstripe has been sent).
UMcontactless UMmagstripe was read via contactless swiper: yes or no (default is no).
UMsignature Cardholder signature captured by pos device. Base64 encoded.

CGI Result Variables

The following CGI variables are returned to your script along with any other fields you have passed to gate.php. For example, if you pass the variable FavoriteColor, gate.php will echo FavoriteColor back in the response.

Field Description
UMstatus Status of the transaction. The possible values are: Approved, Declined, Verification and Error.
UMauthCode Authorization number.
UMrefNum Transaction reference number
UMbatch Batch reference number. This will only be returned for sale and auth commands. Warning: The batch number returned is for the batch that was open when the transaction was initiated. It is possible that the batch was closed while the transaction was processing. In this case the transaction will get queued for the next batch to open.
UMavsResult AVS result in readable format
UMavsResultCode AVS result code.
UMcvv2Result CVV2 result in readable format.
UMcvv2ResultCode CVV2 result code.
UMvpasResultCode Verified by Visa (VPAS) or Mastercard SecureCode (UCAF) result code.
UMresult Transaction result
UMerror Error description if UMstatus is Declined or Error.
UMerrorcode A numerical error code.
UMacsurl Verification URL to send cardholder to. Sent when UMstatus is verification (cardholder authentication is required).
UMpayload Authentication data to pass to verification url. Sent when UMstatus is verification (cardholder authentication is required).
UMisDuplicate Indicates whether this transaction is a folded duplicate or not. 'Y' means that this transaction was flagged as duplicate and has already been processed. The details returned are from the original transaction. Send UMignoreDuplicate to override the duplicate folding.
UMconvertedAmount Amount converted to merchant's currency, when using a multi-currency processor.
UMconvertedAmountCurrency Merchant's currency, when using a multi-currency processor.
UMconversionRate Conversion rate used to convert currency, when using a multi-currency processor.
UMcustnum Customer reference number assigned by gateway. Returned only if UMrecurring=yes.
UMresponseHash Response verification hash. Only present if response hash was requested in the UMhash. (See Source Pin Code section for further details)

Revision History