eWAY API


Refunds

Customer refunds can be processed via XML from your own application or system. The original transaction ID/ reference number is passed to the refund gateway along with the amount to be refunded.

Linking to eWAY

Below are the specifications for using the eWAY Merchant Hosted Payment solution, including fields sent and returned by the gateway and field descriptions.

eWAY Fields Sent Maximum Field Length (Characters) Required Fields
ewayCustomerID 8 Included
ewayTotalAmount 12 Included
ewayCardExpiryMonth 2 Included
ewayCardExpiryYear 2 Included
ewayOriginalTrxnNumber 16 Included
ewayOption1 255
ewayOption2 255
ewayOption3 255
ewayRefundPassword 20 Included
eWAY Fields Returned Maximum Field Length (Characters) Required Fields
ewayTrxnStatus 6 Included
ewayTrxnNumber 16 Included
ewayTrxnReference 50 Included
ewayTrxnOption1 255 Included
ewayTrxnOption2 255 Included
ewayTrxnOption3 255 Included
ewayAuthCode 6 Included
ewayReturnAmount 12 Included
ewayTrxnError 100 Included
eWAY Field Name Description
ewayCustomerID Your unique eWAY customer ID assigned to you when you join eWAY. eg 11438715
ewayTotalAmount The total amount in cents for the refund, eg $1.00 = 100
ewayOriginalTrxnNumber The eWAY transaction number that is to be refunded
ewayOption1 This value is returned to your website. An additional field for you to pass and receive information from eWAY.
ewayOption2 This value is returned to your website. An additional field for you to pass and receive information from eWAY.
ewayOption3 This value is returned to your website. An additional field for you to pass and receive information from eWAY.
ewayRefundPassword The refund password defined by you - this is NOT the password used to login to the eWAY Business Centre
ewayTrxnStatus This value is returned to your website. For a successful transaction "True" is passed and for a failed transaction "False" is passed. This allows you to make your own logging on your website for transaction status.
ewayTrxnNumber The unique transaction number generated by eWAY
ewayAuthCode If the transaction is successful, this is the bank authorisation number. This is also sent in the email receipt.
eWAYReturnAmount Can be used a check that the transaction is processed for the same amount as you request from your website.
ewayTxnError This is the response returned by the bank, and can be related to both successful and failed transactions.

Example XML Layout

Please do not copy/paste the following XML example for your code as it is presented here for display purposes only. Please refer to our source code for more information.

XML Sent


XML Returned

We have provided sample code for ASP.NET (C#) language.

To refund a transaction:

  1. Send the XML document via HTTPS, using SSL.
  2. Parse the XML document returned from eWAY.

This ZIP file contains the following files:

  1. Default.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.
  2. Default.aspx.cs - C# Server-side code for the Default.aspx page.
  3. GatewayConnector.cs - This page connects to the eWAY gateway, sends an XML request and receives the XML response.
  4. 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.
  5. GatewayResponse.cs - This passes the eWAY gateway response back to the WebForm1.aspx page.
  6. 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.