Chargeback

Overview

A chargeback notification is sent to your desired Notification URL containing useful information about the transaction if a chargeback occurs. Below explains the data you can expect to be received in the Notification URL, you can use this data to handle the transaction.

You must submit a desired Notification URL to eCOMM for it to be whitelisted and enabled for use. The notification will be sent via HTTP Form Post in XML format where you should set up a handler to parse the response.

The chargeback notification can be identified by using the apisignature, if chargeback is specified then the following XML document relates to a chargeback. The XML document will be transmitted through a field called data.

Please note that when setting up the handler, you must also cater for the fraud notification as the chargeback and fraud notification will be sent to the same URL.

Setting Up A Handler

It is up to you to decide what may be the best decision when deciding on how to handle the chargeback notification. The below example is intended to give you an idea on how this can be achieved.

If the notification URL is: http://example.com/Notification-Handler/Chargeback-Fraud-Notification/, the HTTP POST will be sent identical to the below sample URL:

http://example.com/Notification-Handler/Chargeback-Fraud-Notification/?apisignature=chargeback&data=<R>...</R>

The XML document will be enclosed in the data parameter which must be parsed in order to pull out the information you may need to proceed.

The apisignature will be chargeback in this case.


Sample Notification Handler:
<?php
// Post Request - Chargeback Notification
if(isset($_POST["data"])) //If we have data
{
	if($_POST["apisignature"] == "chargeback") //Chargeback Notification
	{
		//Handler code for chargeback
		$strData = $_POST["data"]; //Assign the data to variable $strData
		$XMLDataArray = simplexml_load_string($strData); //Used to parse XML at ease
		//...
		
		/* Obtain information from response fields */
		$ResponseR1 = (string)$XMLDataArray->R1;
		$ResponseR2 = (string)$XMLDataArray->R2;
		//... etc
		
		//Or loop through the elements
		/* END */
		
		//More code...
	}
	else if($_POST["apisignature"] == "fraudtransactionnotification") //Fraud Notification
	{
		//Handler code for fraud...
	}
}
?>
// Post Request - Chargeback Notification
[HttpPost]
public IActionResult NotificationURL(string apisignature, string data)
{
	if(data != null) //If we have data
	{
		if(apisignature == "chargeback") //Chargeback Notification
		{
			//Handler code for chargeback
			
			/* Parse XML from response */
			XmlDocument xDoc = new XmlDocument();
			xDoc.LoadXml(data);
			/* END */

			/* Obtain information from response fields */
			XmlNodeList ResponseR1 = xDoc.GetElementsByTagName("R1");
			XmlNodeList ResponseR2 = xDoc.GetElementsByTagName("R2");
			//... etc
			
			//Or loop through the elements
			/* END */
			
			//More code...
		}
		else if(apisignature == "fraudtransactionnotification") //Fraud Notification
		{
			//Handler code for fraud...
		}
	}
	
	return View();
}

Data Returned

The chargeback notification will POST an XML document, below will help identify what XML fields are included and what to expect.

A well defined XML document response will be returned with the following information:
FieldName Description
R1 Received Date
R2 Merchant Name
R3 Chargeback Amount
R4 Parent Transaction Date
R5 Chargeback Date
R6 ARN
R7 Authorisation Code
R8 Chargeback Reason
R9 Chargeback Reference Number
R10 Card Number
R11 Parent Transaction Id
R12 Parent Transaction Amount
R13 Parent Transaction Currency
R14 Chargeback Partial
R15 Merchant Transaction Code

Sample XML Notification

Below demonstrates what is contained inside the data parameter of the notification.

<!-- Sample XML Document, contained inside the `data=` parameter -->
<R>
	<R1>29-10-2015</R1>
	<R2>Len Merchant</R2>
	<R3>100</R3>
	<R4>27-10-2015</R4>
	<R5>11-08-2015</R5>
	<R6>05421215223811034925862</R6>
	<R7>022691</R7>
	<R8>4837 </R8>
	<R9>081103492586</R9>
	<R10>5523********3278</R10>
	<R11>19310</R11>
	<R12>100</R12>
	<R13>EUR</R13>
	<R14>Full Chargeback</R14>
	<R15>5a017421-0a92-4141-a4e9-2fd3969307db</R15>
</R>