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
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 files:
- WebForm.php - An example of a form to send to the eWAY gateway.
- EwayConfig.inc.php - This file contains all configuration information, remember
to change this to your own customerID when you are ready to go live.
- EwayPaymentLive.php - This takes the fields from the WebForm.php page and
converts it to an XML string and sends it to the gateway.
- testewaylive.php - Test page to test the functionality.
- Please Read - - If you are attempting to
execute the PHP Code from a Windows environment, and are receiving an SSL Certificate
error, you may need to add the line:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
when calling the eWAY Gateway, after the line:
$ch = curl_init( $this->myGatewayURL );
For more information on passing XML, please the Field specifications tab.
»
Download the XML PHP sample code - version 4.x and 5.x
- C# Code
This ZIP file contains the following files:
- WebForm1.aspx (2003) / Default.aspx (2005) - 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 (2003) / Default.aspx (2005) - 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 (Microsoft Visual Studio 2003)
»
Download the C# source code (Microsoft Visual Studio 2005)
- C++ Code
Target platform: OS Portable (Source code to work with many OS platforms)
Required libraries:
Library documentation index page: doc\html\index.html
This ZIP file contains the following files:
- \bin - binary files
- \doc - project documentation (doxygen+html)
- \example - example of library usage
- \include - library include
- \src - library sources
- \test - automatic tests
- \tmp - all temporary output files
- readme.txt - Short help
- Eway_Gateway.sln - Solution for MS Visual Studio 2003
- Eway_Gateway.vcproj - Project for build eWAY gateway static library
- Eway_Gateway_Example_App.vcproj - Project for build example of library usage
- Eway_Gateway_Test.vcproj - Project for build automatic tests of library
For more information on passing XML, please see the Field specifications tab.
»
Download the C++ source code
- JAVA Code
This ZIP file contains the following folders:
In the folder \connection_classes_with_demo
- /src - Source files of the connection clases of the com.eway package and
source of demo application
- /bin - Binary versions of the above. The 3 connection classes are also made
available in a single jar
- /doc - Documentation of connection classes in javadoc format. Start with
index.html in the /doc folder
- Readme - More detailed information
For more information on passing XML, please see the Field specifications tab.
»
Download the JAVA source code
- VB.NET Code
This ZIP file contains the following files:
- WebForm1.aspx (2003) / Default.aspx (2005) - 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 (2003) / Default.aspx (2005) - 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.
- readme.txt - Additional notes on the the VB.NET Sample Code.
For more information on passing XML, please see the Field specifications tab.
»
Download the VB.NET source code
You can build and test your website payment solution before joining eWAY.
To test your solution with eWAY, all you need to do is pass the
required test-account information. This test facility uses the real payment functionality,
so there are very few changes required once you join eWAY.
These testing instructions make use of the same sample code we provide
for connection to eWAY.
|
IMPORTANT!
Please make sure you use the following values when testing:
- The test gateway URL is https://www.eway.com.au/gateway/xmltest/testpage.asp
- The test Customer ID is 87654321 - this is the only ID that will
work on the test gateway.
- The test Credit Card number is 4444333322221111 - this is the only
credit card number that will work on the test gateway.
- The test Total Amount should end in 00 or 08 to
get a successful response (e.g. $10.00 or $10.08) - all other amounts will return
a failed response.
|
- Instructions for Testing - ASP
1. Download our ASP XML Sample Code.
2. Ensure the URL in process.asp and Epayment.asa
are:
'https://www.eway.com.au/gateway/xmltest/testpage.asp'
3. Open PaymentForm.htm in Internet Explorer
and set the field values to the following:
|
ewayCustomerID |
87654321 |
Test eWAYcustomerID, you will be issued with your own Live eWAYCusomterID ID once
you . |
"Error: Invalid eWAY TEST Gateway account. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardNumber |
4444333322221111 |
Credit card number |
"Error: Invalid credit card provided. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayCardExpiryMonth |
Greater than or equal to today's month ie 06 for the 04/06/08 |
Credit card expiry month |
"Error: Expiry Month invalid. Your credit card has not been billed for this
transaction.(Test Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardExpiryYear |
Greater than or equal to today's year ie 08 for the 05/05/08 |
Credit card expiry year |
"Error: Expiry Year invalid. Your credit card has not been billed for this transaction.(Test
Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayTotalAmount |
Any integer value, e.g. 1000 (This is $10.00) |
Total amount for the transaction.
All values are to be passed in cents (ie 1000 = $10.00) with no
decimal points, dollar signs, etc. N.B. The cents value passed will correspond to
the response code returned in the XML response, e.g. for 1000 the Response Code
will be 00, for 1050 the Response Code will be 50.
|
"Error: Invalid Amount. Your credit card has not been billed for this transaction.
TotalAmount= 1050 "(Test Gateway)"
|
|
ewayCVN |
Any 3 or 4 digit number |
3 digit security code found on the back of Visa and Mastercard credit cards.
4 digit code for American Express Cards.
* Only require if using the CVN Gateway. |
"Error: Invalid CVN. Your credit card has not been billed for this transaction.(Test
Gateway)" |
4. If you pass anything other than the values in the "Value to pass to eWAY" column
(above), you will receive the respective error message in the "Error Messages" column
(above, right).
If the exact values outined above are passed to the test gateway, the CENTS value
passed in the ewayTotalAmount field will be the Response Code returned,
e.g. if "100" is passed ($1.00), the Response Code will be "00", or if "1015" is
passed ($10.15), the Resonse Code will be "15". These Response Codes also generate
the Response Text, and thus the value returned in ewayTrxnError.
View All Response Codes, and associated Response Text
The other fields returned in the XML will have the following values:
|
ewayTrxnStatus |
True |
False |
|
ewayTrxnNumber |
10000 + |
10000 + |
|
ewayTrxnReference |
value sent in <ewayTrxnNumber> returned |
value sent in <ewayTrxnNumber> returned |
|
ewayAuthCode |
123456 |
empty |
|
ewayReturnAmount |
value sent returned |
value sent returned |
|
ewayTrxnError |
"Response Code,Response Text" (e.g. 00, Transaction Approved(Test Gateway))
View Possible Response Codes and Response Text |
"Response Code, Response Text" (e.g. 01, Do Not Honour(Test Gateway))
OR
See above - "Possible error messages"
View Possible Response Codes and Response Text |
|
ewayTrxnOption1 |
value sent returned |
value sent returned |
|
ewayTrxnOption2 |
value sent returned |
value sent returned |
|
ewayTrxnOption3 |
value sent returned |
value sent returned |
- Instructions for Testing - PHP
1. Download our PHP XML Sample Code.
2. Ensure the variable $eWAY_UseLive = false in EwayConfig.inc.php.
When you are ready to test with the live gateway you simple change this to $eWAY_UseLive
= true
3. Open WebForm.php in a browser and set
the fields to the following values:
|
ewayCustomerID |
87654321 |
Test eWAYcustomerID, you will be issued with your own Live eWAYCusomterID ID once
you . |
"Error: Invalid eWAY TEST Gateway account. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardNumber |
4444333322221111 |
Credit card number |
"Error: Invalid credit card provided. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayCardExpiryMonth |
Greater than or equal to today's month ie 06 for the 04/06/08 |
Credit card expiry month |
"Error: Expiry Month invalid. Your credit card has not been billed for this
transaction.(Test Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardExpiryYear |
Greater than or equal to today's year ie 08 for the 05/05/08 |
Credit card expiry year |
"Error: Expiry Year invalid. Your credit card has not been billed for this transaction.(Test
Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayTotalAmount |
Any integer value, e.g. 1000 (This is $10.00) |
Total amount for the transaction.
All values are to be passed in cents (ie 1000 = $10.00) with no
decimal points, dollar signs, etc. N.B. The cents value passed will correspond to
the response code returned in the XML response, e.g. for 1000 the Response Code
will be 00, for 1050 the Response Code will be 50.
|
"Error: Invalid Amount. Your credit card has not been billed for this transaction.
TotalAmount= 1050 "(Test Gateway)"
|
|
ewayCVN |
Any 3 or 4 digit number |
3 digit security code found on the back of Visa and Mastercard credit cards.
4 digit code for American Express Cards.
* Only require if using the CVN Gateway. |
"Error: Invalid CVN. Your credit card has not been billed for this transaction.(Test
Gateway)" |
4. If you pass anything other than the values in the "Value to pass to eWAY" column
(above), you will receive the respective error message in the "Error Messages" column
(above, right).
If the exact values outlined above are passed to the test gateway, the CENTS value
passed in the ewayTotalAmount field will be the Response Code returned,
e.g. if "100" is passed ($1.00), the Response Code will be "00", or if "1015" is
passed ($10.15), the Resonse Code will be "15". These Response Codes also generate
the Response Text, and thus the value returned in ewayTrxnError.
View All Response Codes, and associated Response Text
The other fields returned in the XML will have the following values:
|
ewayTrxnStatus |
True |
False |
|
ewayTrxnNumber |
10000 + |
10000 + |
|
ewayTrxnReference |
value sent in <ewayTrxnNumber> returned |
value sent in <ewayTrxnNumber> returned |
|
ewayAuthCode |
123456 |
empty |
|
ewayReturnAmount |
value sent returned |
value sent returned |
|
ewayTrxnError |
"Response Code,Response Text" (e.g. 00, Transaction Approved(Test Gateway))
View Possible Response Codes and Response Text |
"Response Code, Response Text" (e.g. 01, Do Not Honour(Test Gateway))
OR
See above - "Possible error messages"
View Possible Response Codes and Response Text |
|
ewayTrxnOption1 |
value sent returned |
value sent returned |
|
ewayTrxnOption2 |
value sent returned |
value sent returned |
|
ewayTrxnOption3 |
value sent returned |
value sent returned |
- Instructions for Testing - C# (ASP.NET)
1. Download our C# XML Sample Code
2. Ensure the URL and eWAYCustomerID in Web.config are
set to the following:
|
<!--
Test Account -->
<add key="ewayCustomerID"
value="87654321"/>
|
|
AND
|
|
<!--
Test gateway -->
<add
key="ewayGateway" value="https://www.eway.com.au/gateway/xmltest/TestPage.asp"/>
|
3. Once your files are added to an ASP.NET Web Application Project, run WebForm1.aspx
in Internet Explorer and set the fields to the following vales:
|
ewayCustomerID |
87654321 |
Test eWAYcustomerID, you will be issued with your own Live eWAYCusomterID ID once
you . |
"Error: Invalid eWAY TEST Gateway account. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardNumber |
4444333322221111 |
Credit card number |
"Error: Invalid credit card provided. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayCardExpiryMonth |
Greater than or equal to today's month ie 06 for the 04/06/08 |
Credit card expiry month |
"Error: Expiry Month invalid. Your credit card has not been billed for this
transaction.(Test Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed
for this transaction.(Test Gateway)" |
|
ewayCardExpiryYear |
Greater than or equal to today's year ie 08 for the 05/05/08 |
Credit card expiry year |
"Error: Expiry Year invalid. Your credit card has not been billed for this transaction.(Test
Gateway)"
OR
"eWAY Error: Invalid Expiry Date. Your credit card has not been billed for this
transaction.(Test Gateway)" |
|
ewayTotalAmount |
Any integer value, e.g. 1000 (This is $10.00) |
Total amount for the transaction.
All values are to be passed in cents (ie 1000 = $10.00) with no
decimal points, dollar signs, etc. N.B. The cents value passed will correspond to
the response code returned in the XML response, e.g. for 1000 the Response Code
will be 00, for 1050 the Response Code will be 50.
|
"Error: Invalid Amount. Your credit card has not been billed for this transaction.
TotalAmount= 1050 "(Test Gateway)"
|
|
ewayCVN |
Any 3 or 4 digit number |
3 digit security code found on the back of Visa and Mastercard credit cards.
4 digit code for American Express Cards.
* Only require if using the CVN Gateway. |
"Error: Invalid CVN. Your credit card has not been billed for this transaction.(Test
Gateway)" |
4. If you pass anything other than the values in the "Value to pass to eWAY" column
(above), you will receive the respective error message in the "Error Messages" column
(above, right).
If the exact values outined above are passed to the test gateway, the CENTS value
passed in the ewayTotalAmount field will be the Response Code returned,
e.g. if "100" is passed ($1.00), the Response Code will be "00", or if "1015" is
passed ($10.15), the Resonse Code will be "15". These Response Codes also generate
the Response Text, and thus the value returned in ewayTrxnError.
View All Response Codes, and associated Response Text
The other fields returned in the XML will have the followin