We have provided sample code for ASP, PHP, C++, JAVA, ASP.NET (C#) and VB.NET 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
The URL the form tag must post to eWAY gateway payment page is
https://www.eway.com.au/gateway_cvn/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 = ""
eWAYCVN = "123"
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_cvn/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="eWAYCVN" value="<%=CStr(eWAYCVN)%>" />
<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>
</td>
<td width="78%" valign="top" bgcolor="#ffffff">
<p>Transaction status is <b><%=result%></b> for transaction
<b><%=CStr(trxnReference) %></b>, your reference is
<b><%=CStr(transaction_number) %></b>
The following additional information was passed <br />
option1 <b><%= CStr(option1) %></b><br />
option2 <b><%= CStr(option2) %></b><br />
option3 <b><%= CStr(option3) %></b>
<p></p><a href="http://www.eway.com.au">Return to eWAY website</a>
</td>
</tr>
</table>
- PHP Code
- C# Code
- VB.NET Code
- Perl - Linux/UNIX
The URL the form tag must post to eWAY gateway payment page is...
https://www.eway.com.au/gateway_cvn/payment.asp
- ColdFusion
The URL the form tag must post to eWAY gateway payment page is...
https://www.eway.com.au/gateway_cvn/payment.asp
Below is an example of the Cold Fusion code required to link to eWAY.
You can build and test your site to link to eWAY before you have joined. All you
need to do is pass the required test account information. This uses the real payment
page so there is little changes required once you have joined eWAY.
In order to test the Shared Payment solution you will need to pass the following
information:
CustomerID: 87654321
Test Credit Card: 4444333322221111
Result: The transaction result is based on the CENT value of the transaction
for more information see the
testing section.
The gateway URL is: https://www.eway.com.au/gateway_cvn/payment.asp
A successful transaction returns (Example):
- ewayTrxnStatus = "True"
- ewayTrxnReference = "1010054" (Varies)
- eWAYresponseCode = "08"
- eWAYresponseText = "TRANSACTION APPROVED(Test Gateway)"
- eWAYAuthCode = "123456"
While a failed transaction returns (Example):
- ewayTrxnStatus = "False"
- ewayTrxnReference = "1010055" (Varies)
- eWAYresponseCode = "31"
- eWAYresponseText = "CARD NOT VALID(Test Gateway)"
- eWAYAuthCode = ""
PLEASE MAKE SURE YOU PASS YOUR ewayCustomerID or the eWAYTESTID of "87654321"
ONLY - passing any other ID may result in funds being deposited into
another bank account other than your own.