Contents

Request types (Webservices API)

Info
A valid requesttypedescription must be included in every request submitted to Trust Payments using the Webservices API. We use the value of this field to determine the type of request required in order to process the request. Please refer to the table below for a summary of the request types that we support.
Warning
The following content assumes you have obtained the necessary PCI certification to process and submit sensitive cardholder data in the request to our Webservices API.

If you are unsure, please contact our Support Team for assistance.

 

Overview

Request type Supported account types Description
ACCOUNTCHECK
  • ECOM
  • MOTO
Performs basic checks on the card and billing address details submitted.
Learn more
AUTH
  • ECOM
  • MOTO
Performs a payment, which debits funds from the customer’s account.
Learn more
CURRENCYRATE
  • CURRENCYRATE
For calculating the transaction amounts in both the currency associated with your site and the local currency associated with the customer’s card. This is to facilitate offering your customers the ability to complete purchases in their preferred currency.
Learn more
ORDER
  • ECOM
Initiate a new payment with PayPal.
Learn more
ORDERDETAILS
  • ECOM
Retrieve the order details from PayPal, after the customer has signed in to their account and agreed to the payment on PayPal’s servers.
Learn more
REFUND
Standard / Payout
  • CFT
  • ECOM
  • MOTO
For transferring funds back to the customer.
Learn more
RISKDEC
  •  FRAUDCONTOL
For processing requests to our Protect Plus system, for purposes of highlighting payments with suspicious characteristics.
Learn more

 

ACCOUNTCHECK

Request ACCOUNTCHECK
Perform checks on the cardholder’s first line of address, the cardholder’s postcode and the security code, without reserving funds on the customer’s account.
Learn more

#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

accountcheck= {
    "currencyiso3a": "GBP",
    "requesttypedescription": "ACCOUNTCHECK",
    "sitereference": "test_site12345",
    "baseamount": "0",
    "orderreference": "My_Order_123",
    "accounttypedescription": "ECOM",
    "billingpremise": "789",
    "billingpostcode": "TE45 6ST",
    "pan": "4111111111111111",
    "expirydate": "12/2022",
    "securitycode": "123"
}

strequest = securetrading.Request()
strequest.update(accountcheck)
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' => '[email protected]',
'password' => 'Password1^',
);

$requestData = array(
'currencyiso3a' => 'GBP',
'requesttypedescription' => 'ACCOUNTCHECK',
'sitereference' => 'test_site12345',
'baseamount' => '0',
'orderreference' => 'My_Order_123',
'accounttypedescription' => 'ECOM',
'billingpremise' => '789',
'billingpostcode' => 'TE45 6ST',
'pan' => '4111111111111111',
'expirydate' => '12/2022',
'securitycode' => '123'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "[email protected]",
"version": "1.00",
"request": [{
  "currencyiso3a": "GBP",
  "requesttypedescription": "ACCOUNTCHECK",
  "sitereference": "test_site12345",
  "baseamount": "0",
  "orderreference": "My_Order_123",
  "accounttypedescription": "ECOM",
  "billingpremise": "789",
  "billingpostcode": "TE45 6ST",
  "pan": "4111111111111111",
  "expirydate": "12/2022",
  "securitycode": "123"
}]}'
{"alias":"[email protected]","version":"1.00","request":[{"currencyiso3a":"GBP","requesttypedescription":"ACCOUNTCHECK","sitereference":"test_site12345","baseamount":"0","orderreference":"My_Order_123","accounttypedescription":"ECOM","pan":"4111111111111111","expirydate":"12\/2020","securitycode":"123","billingpremise":"789","billingpostcode":"TE45 6ST"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="ACCOUNTCHECK">
    <merchant>
      <orderreference>My_Order_123</orderreference>
    </merchant>
    <billing>
      <amount currencycode="GBP">0</amount>
      <postcode>TE45 6ST</postcode>
      <premise>789</premise>
      <payment>
        <pan>4111111111111111</pan>
        <securitycode>123</securitycode>
        <expirydate>12/2020</expirydate>
      </payment>
    </billing>
    <operation>
      <accounttypedescription>ECOM</accounttypedescription>
      <sitereference>test_site12345</sitereference>
    </operation>
  </request>
</requestblock>

 

 

AUTH

Request AUTH
Performs a payment, which debits funds from the customer’s account.
Learn more

#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

auth = {
  "sitereference": "test_site12345",
  "requesttypedescription": "AUTH",
  "accounttypedescription": "ECOM",
  "currencyiso3a": "GBP",
  "baseamount": "1050",
  "orderreference": "My_Order_123",
  "pan": "4111111111111111",
  "expirydate": "12/2022",
  "securitycode": "123"
}

strequest = securetrading.Request()
strequest.update(auth)
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' => '[email protected]',
  'password' => 'Password1^',
);

$requestData = array(
  'sitereference' => 'test_site12345', 
  'requesttypedescription' => 'AUTH',
  'accounttypedescription' => 'ECOM',
  'currencyiso3a' => 'GBP',
  'baseamount' => '1050',
  'orderreference' => 'My_Order_123',
  'pan' => '4111111111111111',
  'expirydate' => '12/2022',
  'securitycode' => '123'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias":"[email protected]",
"version": "1.00",
"request": [{
  "currencyiso3a": "GBP",
  "requesttypedescription": "AUTH",
  "sitereference": "test_site12345",
  "baseamount": "1050",
  "orderreference": "My_Order_123",
  "accounttypedescription": "ECOM",
  "pan": "4111111111111111",
  "expirydate": "12/2022",
  "securitycode": "123"
}]}'
{"alias":"[email protected]om","version":"1.00","request":[{"currencyiso3a":"GBP","requesttypedescription":"AUTH","sitereference":"test_site12345","baseamount":"1050","orderreference":"My_Order_123","accounttypedescription":"ECOM","pan":"4111111111111111","expirydate":"12\/2020","securitycode":"123"}]}
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="AUTH">
    <merchant>
      <orderreference>My_Order_123</orderreference>
    </merchant>
    <billing>
      <payment>
        <expirydate>12/2020</expirydate>
        <pan>4111111111111111</pan>
        <securitycode>123</securitycode>
      </payment>
      <amount currencycode="GBP">1050</amount>
    </billing>
    <operation>
      <sitereference>test_site12345</sitereference>
      <accounttypedescription>ECOM</accounttypedescription>
    </operation>
  </request>
</requestblock>

 

 

CURRENCYRATE

Request CURRENCYRATE
For calculating the transaction amounts in both the currency associated with your site and the local currency associated with the customer’s card. This is to facilitate offering your customers the ability to complete purchases in their preferred currency.

Learn more


#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

currencyrate = {
  "sitereference": "test_site12345",
  "requesttypedescription": "CURRENCYRATE",
  "accounttypedescription": "CURRENCYRATE",
  "dcctype": "DCC",
  "dccbaseamount": "1050",
  "dcccurrencyiso3a": "GBP",
  "orderreference": "My_Order_123",
  "pan": "4111111111111111",
  "expirydate": "12/2022",
  "securitycode": "123"
}

strequest = securetrading.Request()
strequest.update(currencyrate)
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' => '[email protected]',
  'password' => 'Password1^',
);

$requestData = array(
  'sitereference' => 'test_site12345', 
  'requesttypedescription' => 'CURRENCYRATE',
  'accounttypedescription' => 'CURRENCYRATE',
  'dcctype' => 'DCC',
  'dccbaseamount' => '1050',
  'dcccurrencyiso3a' => 'GBP',
  'orderreference' => 'My_Order_123',
  'pan' => '4111111111111111',
  'expirydate' => '12/2022',
  'securitycode' => '123'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias":"[email protected]",
"version": "1.00",
"request": [{
  "sitereference": "test_site12345",
  "requesttypedescription": "CURRENCYRATE",
  "accounttypedescription": "CURRENCYRATE",
  "dcctype": "DCC",
  "dccbaseamount": "1050",
  "dcccurrencyiso3a": "GBP",
  "orderreference": "My_Order_123",
  "pan": "4111111111111111",
  "expirydate": "12/2022",
  "securitycode": "123"
}]}'
{"alias":"[email protected]","version":"1.00","request":[{"sitereference":"test_site12345","requesttypedescription":"CURRENCYRATE","accounttypedescription":"CURRENCYRATE","dcctype":"DCC","dccbaseamount":"1050","dcccurrencyiso3a":"GBP","orderreference":"My_Order_123","pan":"4111111111111111","expirydate":"12\/2020","securitycode":"123"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="CURRENCYRATE">
    <operation>
      <sitereference>test_site12345</sitereference>
      <accounttypedescription>CURRENCYRATE</accounttypedescription>
    </operation>
    <merchant>
      <orderreference>My_Order_123</orderreference>
    </merchant>
    <billing>
      <dcc type="DCC">
        <amount currencycode="GBP">1050</amount>
      </dcc>
      <payment>
	  <pan>4111111111111111</pan>
	  <expirydate>12/2020</expirydate>
	  <securitycode>123</securitycode>
	</payment>
    </billing>
  </request>
</requestblock>

 

 

ORDER

APM
Initiate a new payment with PayPal.
Learn more about PayPal

#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

order = {
    "currencyiso3a": "GBP",
    "requesttypedescription": "ORDER",
    "accounttypedescription": "ECOM",
    "sitereference": "test_site12345",
    "baseamount": "2001",
    "paymenttypedescription": "PAYPAL",
    "returnurl": "https://yourwebsite.com",
    "cancelurl": "https://yourwebsite.com",
    "paypallocale": "GB",
    "paypaladdressoverride": "1",
    "paypalemail": "[email protected]"
}

strequest = securetrading.Request()
strequest.update(order)
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' => '[email protected]',
    'password' => 'Password1^'
);

$requestData = array(
    'currencyiso3a' => 'GBP',
    'requesttypedescription' => 'ORDER',
    'accounttypedescription' => 'ECOM',
    'sitereference' => 'test_site12345',
    'baseamount' => '2001',
    'paymenttypedescription' => 'PAYPAL',
    'returnurl' => 'https://yourwebsite.com',
    'cancelurl' => 'https://yourwebsite.com',
    'paypallocale' => 'GB',
    'paypaladdressoverride' => '1',
    'paypalemail' => '[email protected]'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "[email protected]",
"version": "1.00",
"request": [{
    "currencyiso3a": "GBP",
    "requesttypedescription": "ORDER",
    "accounttypedescription": "ECOM",
    "sitereference": "test_site12345",
    "baseamount": "2001",
    "paymenttypedescription": "PAYPAL",
    "returnurl": "https://yourwebsite.com",
    "cancelurl": "https://yourwebsite.com",
    "paypallocale": "GB",
    "paypaladdressoverride": "1",
    "paypalemail": "[email protected]"
}]}'
{"alias":"[email protected]","version":"1.00","request":[{"currencyiso3a":"GBP","requesttypedescription":"ORDER","accounttypedescription":"ECOM","sitereference":"test_site12345","baseamount":"2001","paymenttypedescription":"PAYPAL","returnurl":"https:\/\/yourwebsite.com","cancelurl":"https:\/\/yourwebsite.com","paypallocale":"GB","paypaladdressoverride":"1","paypalemail":"[email protected]"}]}
<?xml version='1.0' encoding='utf-8'?>
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="ORDER">
    <merchant>
      <returnurl>https://www.example.com/return</returnurl>
      <cancelurl>https://www.example.com/cancel</cancelurl>
    </merchant>
    <billing>
      <amount currencycode="GBP">2001</amount>
      <payment type="PAYPAL">
        <locale>GB</locale>
        <paypaladdressoverride>1</paypaladdressoverride>
        <paypalemail>[email protected]</paypalemail>
      </payment>
    </billing>
    <operation>
      <sitereference>test_site12345</sitereference>
      <accounttypedescription>ECOM</accounttypedescription>
    </operation>
  </request>
</requestblock>

 

 

ORDERDETAILS

APM
Retrieve the order details from PayPal, after the customer has signed in to their account and agreed to the payment on PayPal’s servers.
Learn more about PayPal

#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

orderdetails = {
    "requesttypedescription": "ORDERDETAILS",
    "sitereference": "test_site12345",
    "parenttransactionreference": "72-32-20002"
}

strequest = securetrading.Request()
strequest.update(orderdetails)
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' => '[email protected]',
	'password' => 'Password1^'
	);
	
$requestData = array(
                'requesttypedescription' => 'ORDERDETAILS',
                'sitereference' => 'test_site12345',
                'parenttransactionreference' => '72-32-20002'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
	"alias": "[email protected]",
	"version": "1.00",
	"request": [{
                "requesttypedescription": "ORDERDETAILS",
                "sitereference": "test_site12345",
                "parenttransactionreference": "72-32-20002"
		}]
}'
{"alias":"[email protected]","version":"1.00","request":[{"requesttypedescription":"ORDERDETAILS","sitereference":"test_site12345","parenttransactionreference":"72-32-20002"}]}
<?xml version="1.0" encoding="utf-8"?>
<requestblock version="3.67">
<alias>[email protected]</alias>
 <request type="ORDERDETAILS">
  <operation>
      <sitereference>test_site12345</sitereference>
      <parenttransactionreference>72-32-20002</parenttransactionreference>
  </operation>
 </request>
</requestblock>

 

 

REFUND

Request REFUND
For transferring funds back to the customer.
Learn more about standard refunds / Learn more about payouts

#!/usr/bin/python
import securetrading
  
stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)
  
refund= {
  "requesttypedescription": "REFUND",
  "sitereference": "test_site12345",
  "parenttransactionreference": "1-2-345678"
}
  
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' => '[email protected]',
  'password' => 'Password1^',
);

$requestData = array(
  'requesttypedescription' => 'REFUND',
  'sitereference' => 'test_site12345',
  'parenttransactionreference' => '1-2-345678'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "[email protected]",
"version": "1.00",
"request": [{
  "requesttypedescription": "REFUND",
  "sitereference": "test_site12345",
  "parenttransactionreference": "1-2-345678"
}]}'
{"alias":"[email protected]","version":"1.00","request":[{"requesttypedescription":"REFUND","sitereference":"test_site12345","parenttransactionreference":"1-2-345678"}]}
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="REFUND">
    <operation>
      <sitereference>test_site12345</sitereference>
      <parenttransactionreference>1-2-345678</parenttransactionreference>
    </operation>
  </request>
</requestblock>

 

 

RISKDEC

Request RISKDEC
To process requests to Protect Plus, our sophisticated counter-fraud service. It makes use of the industry’s largest negative database to perform a comprehensive suite of fraud assessments, including identity checks against the UK electoral roll and BT databases.
Learn more

#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

riskdec= {
    "sitereference": "test_site12345",
    "requesttypedescription": "RISKDEC",
    "accounttypedescription": "ECOM",
    "currencyiso3a": "GBP",
    "baseamount": "1011",
    "orderreference": "My_Order_123",
    "pan": "4111111111111111",
    "expirydate": "12/2020",
    "securitycode": "123"
}

strequest = securetrading.Request()
strequest.update(riskdec)
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' => '[email protected]',
'password' => 'Password1^',
);

$requestData = array(
  'sitereference' => 'test_site12345',
  'requesttypedescription' => 'RISKDEC',
  'accounttypedescription' => 'FRAUDCONTROL',
  'currencyiso3a' => 'GBP',
  'baseamount' => '1011',
  'orderreference' => 'My_Order_123',
  'pan' => '4111111111111111',
  'expirydate' => '12/2020',
  'securitycode' => '123'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ <DOMAIN>/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "[email protected]",
"version": "1.00",
"request": [{
  "currencyiso3a": "GBP",
  "requesttypedescription": "RISKDEC",
  "sitereference": "test_site12345",
  "baseamount": "1011",
  "orderreference": "My_Order_123",
  "accounttypedescription": "FRAUDCONTROL",
  "pan": "4111111111111111",
  "expirydate": "12/2020",
  "securitycode": "123"
}]}'
{"alias":"[email protected]","version":"1.00","request":[{"currencyiso3a":"GBP","requesttypedescription":"RISKDEC","sitereference":"test_site12345","baseamount":"1011","orderreference":"My_Order_123","accounttypedescription":"FRAUDCONTROL","pan":"4111111111111111","expirydate":"12\/2020"}]}
<?xml version="1.0" encoding="utf-8"?>
<requestblock version="3.67">
  <alias>[email protected]</alias>
  <request type="RISKDEC">
    <merchant>
      <orderreference>My_Order_123</orderreference>
    </merchant>
    <billing>
      <amount currencycode="GBP">1011</amount>       
      <payment>
        <expirydate>12/2020</expirydate>
        <pan>4111111111111111</pan>
      </payment>
    </billing>
    <operation>
      <accounttypedescription>FRAUDCONTROL</accounttypedescription>
      <sitereference>test_site12345</sitereference>
    </operation>
  </request>
</requestblock>