We have provided sample code for ASP, PHP and ASP.NET (C#) programming languages.
Basically, all you need to do, per transaction, is:
- Send the XML document via HTTPS, using SSL.
- Parse the XML document returned
from eWAY.
- ASP Code
This ZIP file contains the following 3 Active Server Pages:
- ePayment.asa - Creates and sends the XML document to eWAY.
- paymentForm.htm - An example of a form to send to the process.asp page. Be
sure to include a valid eWAYCustomerID when you go live, this will be issued to
you after you join eWAY.
- process.asp - This includes the ePayment.asa file and displays the transaction
results.
For more information on passing XML, please see the Field specifications tab.
»
Download the XML ASP sample code
- PHP Code
This ZIP file contains the following two files:
- EPayment.php - PHP class which you can call from your own PHP code
to process a transaction.
- testform.php - Sample code to process a test transaction. Show
the main functions that you will probably need to call.
For more information on passing XML, please the Field specifications tab.
»
Download the PHP sample code
- C# Code
This ZIP file contains several C#.NET Pages and should be added to a Visual Studio
Project:
- WebForm1.aspx - An example of a form to send to the eWAY
gateway. Be sure to include a valid eWAYCustomerID when you go live. This ID will
be issued to you once you've joined eWAY.
- WebForm1.aspx.cs
- C# Server-side code for the WebForm1.aspx page.
- GatewayConnector.cs - This page connects to the eWAY
gateway, sends an XML request and receives the XML response.
- GatewayRequest.cs - This takes the fields from the WebForm1.aspx
page, and converts it to an XML string to pass to the GatewayConnector.cs page.
- GatewayResponse.cs - This passes the eWAY Gateway
response back to the WebForm1.aspx page.
- web.config - This holds the configuration settings for the live
and test gateway URLs, as well as your eWAY Customer ID and the
ID used for testing.
For more information on passing XML, please see the Field specifications tab.
»
Download the C# source code
There is currently no test account for this facility. Transactions are not processed
immediately with this facility, so to test its functionality you should use the
Live gateway. Transactions can then be deleted through the
eWAY administration area
. Stored transactions incur no fee until they are processed.
The Live gateway address is:
You can link with any of the following languages that support HTML FORMS using the
POST method. If there are any other solutions required, please
contact us.
- ASP Code
The URL the form tag must post to eWAY gateway payment page is
https://www.eway.com.au/gateway/payment.asp
ASP Code sample - copy and paste, then modify values using form elements or a querystring.
<%
'set this infromation from your shopping cart or database
'your eWAY customer details
ewayCustomerID = "87654321"
'amount in cents, here we have 10c
ewayTotalAmount = "10"
'order details
ewayCustomerFirstName = "Roxarne"
ewayCustomerLastName = "Paton"
ewayCustomerEmail = "sales@eway.com.au"
ewayCustomerAddress = "18 Mayne Street Parkes NSW"
ewayCustomerPostcode = "2870"
ewayCustomerInvoiceDescription = "ASP code e-postcard"
ewayCustomerInvoiceRef = "webactive002"
ewayURL = "http://www.webactive.com.au/eway/result.asp"
ewaySiteTitle = "WebActive"
ewayAutoRedirect = "1"
'additional information you can pass
eWAYoption1 = "book"
eWAYoption2 = "section1.xls"
eWAYoption3 = ""
ewayTrxnNumber = "2323"
%>
<table border="1" width="70%" cellspacing="0" cellpadding="5" bordercolor="#000080">
<tr>
<td width="22%" valign="top"><p class="subtitle"><a href="http://www.eway.com.au"
target="_blank"><img alt="eWAY - a total e commerce solution" border="0" height="91"
src="http://www.eway.com.au/images/logos/eway.gif" width="200" /></a><p><p></p></td>
<td width="78%" valign="top" bgcolor="#ffffff">
<form method="post"
action="https://www.eway.com.au/gateway/payment.asp"
>
<input type="hidden" name="ewayCustomerID" value="<%=CStr(ewayCustomerID)%>"
/>
<input type="hidden" name="ewayTotalAmount" value="<%=CStr(ewayTotalAmount)%>"
/>
<input type="hidden" name="ewayCustomerFirstName" value="<%=CStr(ewayCustomerFirstName)%>"
/>
<input type="hidden" name="ewayCustomerLastName" value="<%=CStr(ewayCustomerLastName)%>"
/>
<input type="hidden" name="ewayCustomerEmail" value="<%=CStr(ewayCustomerEmail)%>"
/>
<input type="hidden" name="ewayCustomerAddress" value="<%=CStr(ewayCustomerAddress)%>"
/>
<input type="hidden" name="ewayCustomerPostcode" value="<%=CStr(ewayCustomerPostcode)%>"
/>
<input type="hidden" name="ewayCustomerInvoiceDescription" value="<%=CStr(ewayCustomerInvoiceDescription)%>"
/>
<input type="hidden" name="ewayCustomerInvoiceRef" value="<%=CStr(ewayCustomerInvoiceRef)%>"
/>
<input type="hidden" name="ewayURL" value="<%=CStr(ewayURL)%>" />
<input type="hidden" name="ewaySiteTitle" value="<%=CStr(ewaySiteTitle)%>"
/>
<input type="hidden" name="ewayAutoRedirect" value="<%=CStr(ewayAutoRedirect)%>"
/>
<input type="hidden" name="eWAYoption1" value="<%=CStr(eWAYoption1)%>"
/>
<input type="hidden" name="eWAYoption2" value="<%=CStr(eWAYoption2)%>"
/>
<input type="hidden" name="eWAYoption3" value="<%=CStr(eWAYoption3)%>"
/>
<input type="hidden" name="ewayTrxnNumber" value="<%=CStr(ewayTrxnNumber)%>"
/>
<p><input type="submit" value="Process Secure Credit Card Transaction using
eWAY" name="submit" /><p><p></p>
</form>
</td>
</tr>
</table>
ASP Code sample - result page on YOUR site.
result = Request("ewayTrxnStatus")
trxnReference = Request("ewayTrxnReference")
transaction_number = Request("ewayTrxnNumber")
if transaction_number = "" then
transaction_number = "NOT DEFINED"
end if
option1 = Request("ewayoption1")
option2 = Request("ewayoption2")
option3 = Request("ewayoption3")
%>
<table border="1" width="70%" cellspacing="0" cellpadding="5" bordercolor="#000080">
<tr>
<td width="22%" valign="top"><p class="subtitle">
<a href="http://www.eway.com.au" target="_blank">
<img alt="eWAY - a total e commerce solution" border="0" height="91" src="http://www.eway.com.au/images/logos/eway.gif"
width="200" />
</a><p></p>