For customers that have completed a payment using DCC, it is possible to process refunds by manually submitting a REFUND request using our Webservices API or Portal.
Before proceeding, please note the following:
- The customer’s currency is the currency associated with their card.
- The merchant’s currency is the local currency associated with your account.
If the customer chose to process the payment in the merchant’s currency:
- Process a standard REFUND request through our Webservices API. Click here for the documentation.
- Process a refund using Portal. Click here to learn more.
If the customer chose to process the payment in the customer’s currency, choose one of the four options below:
DCC refunds processed through our Webservices API have a similar structure to standard REFUND requests, but are subject to additional requirements that are outlined below.
It is your responsibility to ensure that all DCC field values you include in any DCC REFUND requests are correct and agreed with your conversion rate provider.
Your conversion rate provider will specify the required process to handle refunds on your account. We recommend that you review the options available and contact our Support Team for further information.
Request
The request has the same structure as a standard REFUND request, except your system will also need to resubmit either the customer currency fields OR the merchant currency fields, as shown below:
Either submit the following two customer currency fields in the request:
currencyiso3a | The customer’s currency. |
baseamount | The amount in the customer’s currency. |
Or, if you prefer to submit the merchant currency fields in the request:
dcccurrencyiso3a | The merchant’s currency. |
dccbaseamount | The amount in the merchant’s currency. |
As with standard REFUND requests, the submitted parenttransactionreference field must refer to the parent AUTH request being refunded (not the CURRENCYRATE request).
#!/usr/bin/python
import securetrading
stconfig = securetrading.Config()
stconfig.username = "webservices@example.com"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)
refund= {
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1641"
}
strequest = securetrading.Request()
strequest.update(refund)
stresponse = st.process(strequest) #stresponse contains the transaction response
<?php
if (!($autoload = realpath(__DIR__ . '/../../../autoload.php')) && !($autoload = realpath(__DIR__ . '/../vendor/autoload.php'))) {
throw new Exception('Composer autoloader file could not be found.');
}
require_once($autoload);
$configData = array(
'username' => 'webservices@example.com',
'password' => 'Password1^',
);
$requestData = array(
'requesttypedescriptions' => array('REFUND'),
'sitereference' => 'test_site12345',
'parenttransactionreference' => '1-2-345678',
'currencyiso3a' => 'USD',
'baseamount' => '1641'
);
$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());
?>
curl --user webservices@example.com:Password1^ <DOMAIN>/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "webservices@example.com",
"version": "1.00",
"request": [{
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1641"
}]}'
{"alias":"webservices@example.com","version":"1.00","request":[{"requesttypedescriptions":["REFUND"],"sitereference":"test_site12345","parenttransactionreference":"1-2-345678","currencyiso3a":"USD","baseamount":"1641"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
<alias>webservices@example.com</alias>
<request type="REFUND">
<billing>
<amount currencycode="USD">1641</amount>
</billing>
<operation>
<sitereference>test_site12345</sitereference>
<parenttransactionreference>1-2-345678</parenttransactionreference>
</operation>
</request>
</requestblock>
Replace <DOMAIN>
with a supported domain. Click here for a full list.
Field specification
Field | Format | Description | |
Submit one of these amounts |
baseamount XPath: /billing/amount |
Numeric (13) |
The amount to be refunded in the customer’s currency (this includes the fee added as part of the Margin Rate Percentage calculation). This should be in base units with no commas or decimal points, so £10 would be 1000. Note: When submitting the baseamount, you must also submit the associated currencyiso3a field. |
dccbaseamount XPath: /billing/dcc/amount |
Numeric (13) |
The amount to be refunded in the merchant’s currency. This should be in base units with no commas or decimal points, so £10 would be 1000. Note: When submitting the dccbaseamount, you must also submit the associated dcccurrencyiso3a field. |
|
Submit one of these currencies |
currencyiso3a XPath: /billing/amount/@currencycode |
Alpha (3) |
The customer’s currency in iso3a format. Click here for a full list of available currencies. Required if the baseamount is submitted. |
dcccurrencyiso3a XPath: /billing/dcc/amount/@currencycode |
Alpha (3) |
The merchant’s currency in iso3a format. Click here for a full list of available currencies. Required if the dccbaseamount is submitted. |
|
dccconversionrate XPath: /billing/dcc/conversionrate |
Numeric (255) | The conversion rate originally used to calculate the amount in the customer’s currency (returned in the original CURRENCYRATE response). | |
dccconversionratesource XPath: /billing/dcc/conversionratesource |
Alphanumeric (255) | The source of the original conversion rate returned from the DCC provider (returned in the original CURRENCYRATE response). | |
dccmarginratepercentage XPath: /billing/dcc/marginratepercentage |
Numeric (11) | The percentage (4 decimal places) used as part of the CURRENCYRATE request to calculate the currency conversion fee, which is automatically appended to the amount in the customer’s currency, following calculation. | |
dccprovider XPath: /billing/dcc/provider |
Alphanumeric (255) | The name of the third-party DCC provider that has provided the conversion rate used in the payment (returned in the original CURRENCYRATE response). | |
dccproviderdata XPath: /billing/dcc/dccproviderdata |
Alphanumeric (255) | A unique string that contains information on the calculated conversion rate, returned directly from participating conversion rate providers (returned in the original CURRENCYRATE response). | |
dcctype XPath: /billing/dcc/dcctype |
Alpha (3) | If submitted, this must be “DCC”. | |
parenttransactionreference XPath: /operation/parenttransactionreference |
Alphanumeric & hyphens (25) |
This field must contain the transaction reference of the AUTH request that you would like to refund. | |
requesttypedescriptions XPath: /@type |
Alpha (20) | You must submit “REFUND”. | |
sitereference XPath: /operation/sitereference |
Alphanumeric & underscore (50) |
Identifies your site on the Trust Payments system. If you do not know your site reference, please contact our Support Team. |
Partial refund
By submitting a baseamount OR dccbaseamount with a lower value than originally authorised, your system can process partial refunds. We will automatically recalculate the amount in the other currency and this will be returned in the response.
Response
The response returned will follow a similar structure to a standard REFUND response, with the addition of DCC-specific fields, as described below.
The DCC-specific fields returned will have the same values as in the initial CURRENCYRATE and AUTH requests, reflecting that the same conversion data has been applied.
The dccratio value is calculated using the refund amount in the customer and merchant currencies. Because this value is calculated after the conversion has taken place, and the converted amount is rounded, the dccratio returned in the response may differ slightly from that used in the initial payment.
Field specification
Field | Format | Description | |
baseamount XPath: /billing/amount |
Numeric (13) | The amount refunded in the customer’s currency (this includes the fee added as part of the Margin Rate Percentage calculation). This is in base units with no commas or decimal points, so £10 would be 1000. | |
dccbaseamount XPath: /billing/dcc/amount |
Numeric (13) | The amount refunded in the merchant’s currency. This is in base units with no commas or decimal points, so £10 would be 1000. | |
currencyiso3a XPath: /billing/amount/@currencycode |
Alpha (3) |
The customer’s currency in iso3a format. |
|
dcccurrencyiso3a XPath: /billing/dcc/amount/@currencycode |
Alpha (3) |
The merchant’s currency in iso3a format. |
|
dccconversionrate XPath: /billing/dcc/conversionrate |
Numeric (255) | The conversion rate originally used to calculate the amount in the customer’s currency. | |
dccconversionratesource XPath: /billing/dcc/conversionratesource |
Alphanumeric (255) | The source of the original conversion rate returned from the DCC provider. | |
dccenabled XPath: /billing/dcc/@enabled |
Numeric (1) | The value returned will be “1”, indicating the account used for processing this payment is enabled for DCC. | |
dccmarginratepercentage XPath: /billing/dcc/marginratepercentage |
Numeric (11) | The percentage (4 decimal places) used as part of the CURRENCYRATE request to calculate the currency conversion fee, which is automatically appended to the amount in the customer’s currency, following calculation. | |
dccoffered XPath: /billing/dcc/offered |
Numeric (1) |
This value represents whether the REFUND was processed in the customer’s currency or the merchant’s currency:
1 – The customer was refunded in the customer’s currency. 3 – The customer was refunded in the merchant’s currency. |
|
dccproviderdata XPath: /billing/dcc/dccproviderdata |
Alphanumeric (255) | A unique string that contains information on the calculated conversion rate, returned directly from participating conversion rate providers. | |
dccratio XPath: /billing/dcc/ratio |
Numeric (255) | The ratio between both amounts processed in the request in main units. | |
dcctype XPath: /billing/dcc/dcctype |
Alpha (3) | This is returned as “DCC”. | |
parenttransactionreference XPath: /operation/parenttransactionreference |
Alphanumeric & hyphens (25) |
The transaction reference of the AUTH request refunded. | |
requesttypedescription XPath: /@type |
Alpha (20) | This is returned as “REFUND”. |
Process overview
-
Perform a new CURRENCYRATE request.
Note: When performing a partial refund, you will need to submit a lower dccbaseamount in the request. - Perform a REFUND request, ensuring all DCC-specific fields returned in the new CURRENCYRATE response are submitted (see list below).
As with standard REFUND requests, the submitted parenttransactionreference field must refer to the parent AUTH request being refunded (not the CURRENCYRATE request).
Request
The following is an example of a request to process a REFUND using a new conversion rate. This presumes you have already performed a new CURRENCYRATE request and are including the new data in the REFUND request (Refer to the field specification below for further information on these fields)
#!/usr/bin/python
import securetrading
stconfig = securetrading.Config()
stconfig.username = "webservices@example.com"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)
refund= {
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1260",
"dcctype": "DCC",
"dccconversionrate": "1.2",
"dccconversionratesource": "Rate Source",
"dccmarginratepercentage": "2.5000",
"dcccurrencyiso3a": "GBP",
"dccbaseamount": "1050",
"dccprovider": "Test Provider",
"dccproviderdata": "01020304120021250373330603INR0803356200513800210875190000300124306MBB01"
}
strequest = securetrading.Request()
strequest.update(refund)
stresponse = st.process(strequest) #stresponse contains the transaction response
<?php
if (!($autoload = realpath(__DIR__ . '/../../../autoload.php')) && !($autoload = realpath(__DIR__ . '/../vendor/autoload.php'))) {
throw new Exception('Composer autoloader file could not be found.');
}
require_once($autoload);
$configData = array(
'username' => 'webservices@example.com',
'password' => 'Password1^',
);
$requestData = array(
'requesttypedescriptions' => array('REFUND'),
'sitereference' => 'test_site12345',
'parenttransactionreference' => '1-2-345678',
'currencyiso3a' => 'USD',
'baseamount' => '1260',
'dcctype' => 'DCC',
'dccconversionrate' => '1.2',
'dccmarginratepercentage' => '2.5000',
'dcccurrencyiso3a' => 'GBP',
'dccbaseamount' => '1050'
'requesttypedescriptions' => array('REFUND'),
'sitereference' => 'test_site12345',
'parenttransactionreference' => '1-2-345678',
'currencyiso3a' => 'USD',
'baseamount' => '1260',
'dcctype' => 'DCC',
'dccconversionrate' => '1.2',
'dccconversionratesource' => 'Rate Source',
'dccmarginratepercentage' => '2.5000',
'dcccurrencyiso3a' => 'GBP',
'dccbaseamount' => '1050',
'dccprovider' => 'Test Provider',
'dccproviderdata' => '01020304120021250373330603INR0803356200513800210875190000300124306MBB01'
);
$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());
?>
curl --user webservices@example.com:Password1^ <DOMAIN>/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "webservices@example.com",
"version": "1.00",
"request": [{
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1260",
"dcctype": "DCC",
"dccconversionrate": "1.2",
"dccconversionratesource": "Rate Source",
"dccmarginratepercentage": "2.5000",
"dcccurrencyiso3a": "GBP",
"dccbaseamount": "1050",
"dccprovider": "Test Provider",
"dccproviderdata": "01020304120021250373330603INR0803356200513800210875190000300124306MBB01"
}]}'
{"alias":"webservices@example.com","version":"1.00","request":[{"requesttypedescriptions":["REFUND"],"sitereference":"test_site12345","parenttransactionreference":"1-2-345678","currencyiso3a":"USD","baseamount":"1260","dcctype":"DCC","dccconversionrate":"1.2","dccconversionratesource":"Rate Source","dccmarginratepercentage":"2.5000","dcccurrencyiso3a":"GBP","dccbaseamount":"1050","dccprovider":"Test Provider","dccproviderdata":"01020304120021250373330603INR0803356200513800210875190000300124306MBB01"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
<alias>webservices@example.com</alias>
<request type="REFUND">
<billing>
<amount currencycode="USD">1260</amount>
<dcc type="DCC">
<amount currencycode="GBP">1050</amount>
<conversionrate>1.2</conversionrate>
<conversionratesource>Rate Source</conversionratesource>
<provider>Test Provider</provider>
<dccproviderdata>01020304120021250373330603INR0803356200513800210875190000300124306MBB015</dccproviderdata>
<marginratepercentage>2.5000</marginratepercentage>
</dcc>
</billing>
<operation>
<sitereference>test_site12345</sitereference>
<parenttransactionreference>1-2-345678</parenttransactionreference>
</operation>
</request>
</requestblock>
Replace <DOMAIN>
with a supported domain. Click here for a full list.
Field specification
Field | Format | Description | |
baseamount XPath: /billing/amount |
Numeric (13) | The amount to be refunded in the customer’s currency (this includes the fee added as part of the Margin Rate Percentage calculation). This should be in base units with no commas or decimal points, so £10 would be 1000. | |
dccbaseamount XPath: /billing/dcc/amount |
Numeric (13) | The amount to be refunded in the merchant’s currency. This should be in base units with no commas or decimal points, so £10 would be 1000. | |
currencyiso3a XPath: /billing/amount/@currencycode |
Alpha (3) |
The customer’s currency in iso3a format. |
|
dcccurrencyiso3a XPath: /billing/dcc/amount/@currencycode |
Alpha (3) |
The merchant’s currency in iso3a format. |
|
dccconversionrate XPath: /billing/dcc/conversionrate |
Numeric (255) | The conversion rate used to calculate the new amounts (returned in the new CURRENCYRATE response). | |
dccconversionratesource XPath: /billing/dcc/conversionratesource |
Alphanumeric (255) | The source of the new conversion rate returned from the DCC provider (returned in the new CURRENCYRATE response). | |
dccmarginratepercentage XPath: /billing/dcc/marginratepercentage |
Numeric (11) | The percentage used as part of the new CURRENCYRATE request, to calculate the currency conversion fee (4 decimal places), automatically added to the amount in the customer’s currency by the DCC provider. | |
dccprovider XPath: /billing/dcc/provider |
Alphanumeric (255) | The name of the third-party DCC provider that has provided the conversion rate used in the payment (returned in the new CURRENCYRATE response). | |
dccproviderdata XPath: /billing/dcc/dccproviderdata |
Alphanumeric (255) | A unique string that contains information on the calculated conversion rate, returned directly from participating conversion rate providers (returned in the new CURRENCYRATE response). | |
dcctype XPath: /billing/dcc/dcctype |
Alpha (3) | You must submit “DCC”. | |
parenttransactionreference XPath: /operation/parenttransactionreference |
Alphanumeric & hyphens (25) |
This field must contain the transaction reference of the AUTH request that you would like to refund. | |
requesttypedescriptions XPath: /@type |
Alpha (20) | You must submit “REFUND”. | |
sitereference XPath: /operation/sitereference |
Alphanumeric & underscore (50) |
Identifies your site on the Trust Payments system. If you do not know your site reference, please contact our Support Team. |
Response
The response returned will follow a similar structure to a standard REFUND response, with the addition of DCC-specific fields, as described below.
The DCC-specific fields returned will have the same values as in the new CURRENCYRATE request, reflecting that the new conversion data has been applied.
Field specification
Field | Format | Description | |
baseamount XPath: /billing/amount |
Numeric (13) | The amount refunded in the customer’s currency (this includes the fee added as part of the Margin Rate Percentage calculation). This is in base units with no commas or decimal points, so £10 would be 1000. | |
dccbaseamount XPath: /billing/dcc/amount |
Numeric (13) | The amount refunded in the merchant’s currency. This is in base units with no commas or decimal points, so £10 would be 1000. | |
currencyiso3a XPath: /billing/amount/@currencycode |
Alpha (3) |
The customer’s currency in iso3a format. |
|
dcccurrencyiso3a XPath: /billing/dcc/amount/@currencycode |
Alpha (3) |
The merchant’s currency in iso3a format. |
|
dccconversionrate XPath: /billing/dcc/conversionrate |
Numeric (255) | The conversion rate used to calculate the new amounts (returned in the new CURRENCYRATE response). | |
dccconversionratesource XPath: /billing/dcc/conversionratesource |
Alphanumeric (255) | The source of the new conversion rate returned from the DCC provider (returned in the new CURRENCYRATE response). | |
dccenabled XPath: /billing/dcc/@enabled |
Numeric (1) | The value returned will be “1”, indicating the account used for processing this payment is enabled for DCC. | |
dccmarginratepercentage XPath: /billing/dcc/marginratepercentage |
Numeric (11) | The percentage used as part of the new CURRENCYRATE request, to calculate the currency conversion fee (4 decimal places), automatically added to the amount in the customer’s currency by the DCC provider. | |
dccoffered XPath: /billing/dcc/offered |
Numeric (1) |
This value represents whether the REFUND was processed in the customer’s currency or the merchant’s currency:
1 – The customer was refunded in the customer’s currency. 3 – The customer was refunded in the merchant’s currency. |
|
dccprovider XPath: /billing/dcc/provider |
Alphanumeric (255) | The name of the third-party DCC provider that has provided the conversion rate used in the payment. | |
dccproviderdata XPath: /billing/dcc/dccproviderdata |
Alphanumeric (255) | A unique string that contains information on the calculated conversion rate, returned directly from participating conversion rate providers. | |
dccratio XPath: /billing/dcc/ratio |
Numeric (255) | The ratio between both amounts processed in the request in main units. | |
dcctype XPath: /billing/dcc/dcctype |
Alpha (3) | This is returned as “DCC”. | |
parenttransactionreference XPath: /operation/parenttransactionreference |
Alphanumeric & hyphens (25) |
The transaction reference of the AUTH request refunded. | |
requesttypedescription XPath: /@type |
Alpha (20) | This is returned as “REFUND”. |
Process overview
Your conversion rate provider may require you to use a new conversion rate when performing a DCC refund after a pre-specified number of days have passed since the parent AUTH was processed (we’ll refer to this as x days). To address this, our Support Team can configure your account to behave in the following way:
- Submit DCC REFUND request.
- If less than x days have passed since the AUTH, we will process a refund using the original conversion rate.
- If greater than x days have passed since the AUTH, we will automatically perform a new CURRENCYRATE request and use the output to process a refund using the latest conversion rate.
To have this configured for your account or to find out further information, please contact our Support Team.
Request
The request has the same structure as a standard REFUND request, except your system will also need to resubmit either the customer currency fields OR the merchant currency fields, as shown below:
Either submit the following two customer currency fields in the request:
currencyiso3a | The customer’s currency. |
baseamount | The amount in the customer’s currency. |
Or, if you prefer to submit the merchant currency fields in the request:
dcccurrencyiso3a | The merchant’s currency. |
dccbaseamount | The amount in the merchant’s currency. |
As with standard REFUND requests, the submitted parenttransactionreference field must refer to the parent AUTH request being refunded (not the CURRENCYRATE request).
This implementation supports both partial refunds and full refunds. Simply submit a lower baseamount OR dccbaseamount and we will calculate the value in the other currency.
#!/usr/bin/python
import securetrading
stconfig = securetrading.Config()
stconfig.username = "webservices@example.com"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)
refund= {
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1641"
}
strequest = securetrading.Request()
strequest.update(refund)
stresponse = st.process(strequest) #stresponse contains the transaction response
<?php
if (!($autoload = realpath(__DIR__ . '/../../../autoload.php')) && !($autoload = realpath(__DIR__ . '/../vendor/autoload.php'))) {
throw new Exception('Composer autoloader file could not be found.');
}
require_once($autoload);
$configData = array(
'username' => 'webservices@example.com',
'password' => 'Password1^',
);
$requestData = array(
'requesttypedescriptions' => array('REFUND'),
'sitereference' => 'test_site12345',
'parenttransactionreference' => '1-2-345678',
'currencyiso3a' => 'USD',
'baseamount' => '1641'
);
$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());
?>
curl --user webservices@example.com:Password1^ <DOMAIN>/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "webservices@example.com",
"version": "1.00",
"request": [{
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "1-2-345678",
"currencyiso3a": "USD",
"baseamount": "1641"
}]}'
{"alias":"webservices@example.com","version":"1.00","request":[{"requesttypedescriptions":["REFUND"],"sitereference":"test_site12345","parenttransactionreference":"1-2-345678","currencyiso3a":"USD","baseamount":"1641"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
<alias>webservices@example.com</alias>
<request type="REFUND">
<billing>
<amount currencycode="USD">1641</amount>
</billing>
<operation>
<sitereference>test_site12345</sitereference>
<parenttransactionreference>1-2-345678</parenttransactionreference>
</operation>
</request>
</requestblock>
Replace <DOMAIN>
with a supported domain. Click here for a full list.
It is also possible to refund DCC payments by using Portal. If the payment was processed using the customer’s currency (shown within Portal as dccoffered = 1), we automatically perform a new CURRENCYRATE request in order to refund the customer using an up-to-date conversion rate. Portal also supports the ability to process partial refunds.
Click here for documentation on performing refunds using Portal.
The ability to refund transactions using Portal is limited to users with certain user roles (Click here for information on different user roles).