# 760 – Request Refund

## **760 Request Data description**

| NODE        | INCLUDE IN CHECKSUM (IN THIS ORDER) | REQUIRED | DATA TYPE                 | DESCRIPTION                                                                                                                                                                                                                                                                                                                               |
| ----------- | ----------------------------------- | -------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiUser     | YES (1)                             | YES      | Character max 50.         | The API user assigned by the Gateway to the merchant. Can be obtained from the website inside your merchant account.                                                                                                                                                                                                                      |
| apiPassword | YES (2)                             | YES      | Character max 50.         | The API password assigned by Gateway to the merchant. Can be obtained from the website inside your merchant account.                                                                                                                                                                                                                      |
| apiCmd      | YES (3)                             | YES      | 760                       | 3 digit numeric transaction code must be 760                                                                                                                                                                                                                                                                                              |
| gatetransid | Yes (4)                             | YES      | Character max 50.         | Unique gateway internal transaction id, received by the merchant in the originating 700 transaction, refers to charge transaction for which the refund has been requested.                                                                                                                                                                |
| amount      | YES (5)                             | YES      | Number with point decimal | Refunds will be in currency of the original charge transaction. The amount requested for refund may not exceed the original amount less any previous refunds approved for this transaction. Decimal separator must be point (.). example: 125.45 = One hundred and twenty-five Major Currency Units with forty-five Minor Currency Units. |
| reason      |                                     | YES      | Character max 256.        | Merchant reason for requesting refund                                                                                                                                                                                                                                                                                                     |
| checksum    |                                     | YES      | Character no limit        | SHA-1 calculated using the fields specified by the transaction plus the API key assigned by gateway to the merchant. This field must be calculated using the fields marked as “Include in checksum” (in the order indicated) plus the API key at the end.                                                                                 |

## **760 Response Data description**

| NODE         | REQUIRED | DATA TYPE           | DESCRIPTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------ | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| result       | YES      | Character           | Result indicates the result of the transaction. NOTE: Refunds are “requested” by the Merchant. Depending on the Merchant Agreement, the refund may be automatically processed or may be delayed for review by gateway personnel. SUCCESS: Refund has been Approved PENDING: Request for refund has been accepted but yet processed. After the Refund has been processed, the results will be sent in the 860 Refund Notification that will be sent from the system server to the merchant server. Do NOT ASSUME the pending request as SUCCESS or DECLINED. ERROR: means error detected in the request, no processing takes place, and transaction was not accepted by the system. No record for the transaction has been created. |
| gatetransid  | COND     | Character 36        | Gateway transaction ID. Will be sent in the response only if the result is not ERROR. Merchant should save this reference number for other transaction activity performed through API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| errorcode    | YES      | Character exactly 3 | Error Code of the transaction or 000 if no error condition found.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| errormessage | OPT      | Character max 100   | Full description of the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

{% tabs %}
{% tab title="CURL" %}
**760 Request Sample**

```
  <?xmlversion="1.0" encoding="utf-8" ?>
<transaction>
		<apiUser> </apiUser>
		<apiPassword> </apiPassword>
		<apiCmd>760</apiCmd>
		<gatetransid> </gatetransid>
		<amount> </amount>
		<reason> </reason>
		<checksum> </checksum>		
</transaction> 
							  
```

**760 Request Response**

The response to a 760 - Request Refund is a plain xml un-encoded that contains the following data:

```

	<?xmlversion="1.0" encoding="utf-8" ?>
	<transaction>
		<result> </result>
		<gatetransid> </gatetransid>
		<errorcode> </errorcode>
		<errormessage> </errormessage>
	</transaction> 
```

{% endtab %}

{% tab title="PHP" %}
760 Request Sample

```
 
require_once 'autoload.php';

use Omnipay\GPNDataEurope\GPNGateway;
set_time_limit(0);

$gpnGateway = new GPNGateway();
$gpnGateway->setApiKey('APIKEY');
$gpnGateway->setApiPassword('APIPASS');
$gpnGateway->setApiUser('APIUSER');
$gpnGateway->setMode(GPNGateway::PROD_MODE);
$gpnGateway->setPROD('https://txtest.txpmnts.com/api/transaction/');


$params = [
	'gatewayTransactionId' => '45CCC608-9BA3-9DE1-C6BB-00466386DEDD',
	'amount' => '10.00',
	'reason' => 'test'	
];

try {
	// Request Refund 760
	$response = $gpnGateway->refund($params)->send();


	printf("%s-%s\n", $response->getCode(), $response->getMessage());
	
echo 'GPN Ref. No : '; print_r($response->getData()->getrefer());
echo 'Description : '; print_r($response->getData()->getmessage());
echo 'Merchant Transaction ID : '; print_r($response->getData()->getmerchantTransId());
echo 'Status : '; print_r($response->getData()->getstatus());
echo 'Status Code : '; print_r($response->getData()->getstatusCode());
echo 'Gateway Transaction ID : '; print_r($response->getData()->gettransId());

} catch (Exception $exc) {
	print_r($exc->getCode(), $exc->getMessage());
}
```

{% endtab %}
{% endtabs %}
