Refunds

You can refund transactions without logging into eWAY – refunds can be processed within your own application or system. Simply pass the original transaction ID or reference number to the refund gateway via XML along with the amount to be refunded.

Linking to eWAY

Below are the specifications for processing refunds, descriptions of the fields sent to and returned by our payment gateway.

Sample code and sandbox testing are available from within MYeWAY, along with many free resources for our registered development partners. 

Refunds

The gateway URL is https://www.eway.com.au/gateway/xmlpaymentrefund.asp

Transaction request
Field Name Maximum Length Required
ewayCustomerID 8 Required
ewayTotalAmount 12 Required
ewayCardExpiryMonth 2  
ewayCardExpiryYear 2  
ewayOriginalTrxnNumber 16 Required
ewayOption1 255  
ewayOption2 255  
ewayOption3 255  
ewayRefundPassword 20 Required
ewayCustomerInvoiceRef 50  

Sample XML Sent

Refund requests must be sent to the gateway in UTF-8 XML format. Although not all fields are listed as required, you must ensure that all tags are included in the XML, even if they are empty. Any special characters must be escaped.

<ewaygateway>
  <ewayCustomerID> 87654321 </ewayCustomerID>
  <ewayOriginalTrxnNumber>1234567</ewayOriginalTrxnNumber>
  <ewayTotalAmount>10</ewayTotalAmount>
  <ewayCardExpiryMonth>04</ewayCardExpiryMonth>
  <ewayCardExpiryYear>09</ewayCardExpiryYear>
  <ewayOption1></ewayOption1>
  <ewayOption2></ewayOption2>
  <ewayOption3></ewayOption3>
  <ewayRefundPassword>password123</ewayRefundPassword>
</ewaygateway>

Transaction response
Field Name Maximum Length
ewayTrxnError 100
ewayTrxnStatus 6
ewayTrxnNumber 16
ewayTrxnOption1 255
ewayTrxnOption2 255
ewayTrxnOption3 255
ewayReturnAmount 12
ewayAuthCode 6
ewayTrxnReference 50

Sample XML Received (Valid Transaction)

<ewayResponse>
  <ewayTrxnStatus>True</ewayTrxnStatus>
  <ewayTrxnNumber>1234567</ewayTrxnNumber>
  <ewayTrxnReference>987654321</ewayTrxnReference>
  <ewayTrxnOption1/>
  <ewayTrxnOption2/>
  <ewayTrxnOption3/>
  <ewayAuthCode>123456</ewayAuthCode>
  <ewayReturnAmount>10</ewayReturnAmount>
  <ewayTrxnError>00,Transaction Approved<ewayTrxnError>
</ewayResponse>

Sample XML Received (Invalid Transaction)

<ewayResponse>
  <ewayTrxnStatus>False</ewayTrxnStatus>
  <ewayTrxnNumber/>
  <ewayTrxnReference>987654321</ewayTrxnReference>
  <ewayTrxnOption1/>
  <ewayTrxnOption2/>
  <ewayTrxnOption3/>
  <ewayAuthCode/>
  <ewayReturnAmount>10</ewayReturnAmount>
  <ewayTrxnError>eWAY Error: Invalid Expiry Date. Your credit card has not been billed for this transaction.</ewayTrxnError>
</ewayResponse>

Sent and returned
eWAY Field Name Description
ewayCustomerID Your unique eWAY customer ID assigned to you when you join eWAY. eg 87654321
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 MYeWAY.
ewayCustomerInvoiceRef    A reference to your own invoice system for the refund. 
N.B. This field may be omitted from the XML document if it is not being used, and does NOT need to be passed blank. All other fields must be passed blank if they are not being used.
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.