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 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.
In order to test the CVN XML 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 test gateway URL is:
https://www.eway.com.au/gateway/xmltest/testpage.asp
- Instructions for Testing - ASP
- Download our ASP XML Sample Code.
- Ensure the URL in process.asp and Epayment.asa
are:
'https://www.eway.com.au/gateway/xmltest/testpage.asp'
- Open PaymentForm.htm in Internet Explorer and
set the field values to the following:
- 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
- Instructions for Testing - PHP
- Download our PHP XML Sample Code.
- 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
- Open WebForm.php in a browser and set the
fields to the following values:
- 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
- Instructions for Testing - C# (ASP.NET)
- Download our C# XML Sample Code.
- 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"/>
- 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:
- 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
- Instructions for Testing - JAVA
- Download our JAVA XML Sample Code
- To test the connectivity to our test gateway you can run the test code from the
bin folder. Run the following command in a command prompt/console window:
java test.GatewayDemo
This will execute 4 payment requests in sequence using the test gateways:
- Real-time request
- Real-time request with CVN
- Beagle request
- Beagle request with CVN
- Instructions for Testing - C++
- Download our C++ Sample Code
- To test the connectivity to our test gateway you can run the example code from the
bin folder. Run the following command in a command prompt/console window:
Eway_Gateway_Example_Appd.exe
This will execute 1 payment request using the test account and the test gateway.
The source code for the example is in the \src folder. You can change the values
of the eWAYcustomerID and the credit card details when you are ready to test to
the live gateway. To change to the live gateway you have to change the
request.SetURL(URLPaymentWithoutCVNTest) to request.SetURL(URLPaymentWithoutCVN)
in the main_example.cpp in the \src folder.
- Instructions for Testing - VB.NET
- Download our VB.NET XML Sample Code
- 2. Ensure the URL and eWAYCustomerID in Web.config are
set to the following:
<!--
eWAYCustomerID -->
<add key="ewayCustomerID"
value="87654321"/>
AND
<!--
Gateway URL -->
<add
key="ewayGateway" value=
"https://www.eway.com.au/gateway/xmltest/TestPage.asp"/>
- 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:
- 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