Cash to Code

PAYMENT Cash to Code
Cash to Code allows customers to complete online payments using cash at one of the thousands of retail locations across Europe. Customers select a deposit amount within the app and a barcode is generated that can be presented at their chosen point-of-sale, allowing them to pay in cash and instantly have their gaming account credited. This page outlines how to process payments using Cash to Code.



Supported customer countries No restrictions on customer countries.
Supported currencies
Protect Plus Supported.
Refunds Refunds not supported.
Payments are not subject to chargebacks.




To enable Cash to Code on your account, please get in touch with your account manager.
A test sandbox account will be provided, which you will need when testing your implementation.



Process overview

What will the customer see?

  • During the checkout process, your app / website states that Cash to Code is a supported payment method.
  • The customer enters their details and opts to pay using Cash to Code.
  • The customer is redirected to pages hosted by Cash to Code. Here, they choose their preferred retail location, after which, they are displayed a unique code.
  • The customer provides their unique code to the retailer they selected earlier and completes the payment by paying with cash.
  • If the customer still has their browser window open, they can click to be redirected back to your app / website, which can then display a success message of your choosing.



How does it work behind the scenes?

The Cash to Code payment flow can be split into three main parts, as shown below:


Performing the authorisation


Redirect to Cash to Code




If the previous steps have been successful and the customer has completed the payment with cash:


Handling errors

In the unlikely event of an unexpected error occurring while on Cash to Code’s pages, the customer’s browser may be redirected to the page specified in the errorurlredirect field. This page will need to inform the customer that there has been a problem with processing the payment, and that they should seek assistance from your organisation / business to determine its status. In such a scenario, we recommend contacting our Support team for assistance.


1. Performing the authorisation

AUTH request

The following is an example AUTH request to be submitted when processing a Cash to Code payment:

import securetrading

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

auth = {
  "sitereference": "test_site12345",
  "requesttypedescriptions": ["AUTH"],
  "accounttypedescription": "ECOM",
  "currencyiso3a": "EUR",
  "baseamount": "2500",
  "successfulurlredirect": "",
  "errorurlredirect": "",
  "billingid": "1234567",
  "billingdob": "1994-01-01",
  "billingalias": "myuser",
  "billingcountryiso2a": "AT",
  "billingreturning": "0",
  "billingfirstname": "Joe",
  "billinglastname": "Bloggs",
  "paymenttypedescription": "CASHTOCODE"

strequest = securetrading.Request()
stresponse = st.process(strequest) #stresponse contains the transaction response

if (!($autoload = realpath(__DIR__ . '/../../../autoload.php')) && !($autoload = realpath(__DIR__ . '/../vendor/autoload.php'))) {
  throw new Exception('Composer autoloader file could not be found.');

$configData = array(
  'username' => '[email protected]',
  'password' => 'Password1^',

$requestData = array(
  'sitereference' => 'test_site12345',
  'requesttypedescriptions' => array('AUTH'),
  'accounttypedescription' => 'ECOM',
  'currencyiso3a' => 'EUR',
  'baseamount' => '2500',
  'successfulurlredirect' => '',
  'errorurlredirect' => '',
  'billingid' => '1234567',
  'billingdob' => '1994-01-01',
  'billingalias' => 'myuser',
  'billingcountryiso2a' => 'AT',
  'billingreturning' => '0',
  'billingfirstname' => 'Joe',
  'billinglastname' => 'Bloggs',
  'paymenttypedescription' => 'CASHTOCODE'

$api = Securetradingapi($configData);
$response = $api->process($requestData);

curl --user [email protected]:Password1^ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias":"[email protected]",
"version": "1.00",
"request": [{
  "sitereference": "test_site12345",
  "requesttypedescriptions": ["AUTH"],
  "accounttypedescription": "ECOM",
  "currencyiso3a": "EUR",
  "baseamount": "2500",
  "successfulurlredirect": "",
  "errorurlredirect": "",
  "billingid": "1234567",
  "billingdob": "1994-01-01",
  "billingalias": "myuser",
  "billingcountryiso2a": "AT",
  "billingreturning": "0",
  "billingfirstname": "Joe",
  "billinglastname": "Bloggs",
  "paymenttypedescription": "CASHTOCODE"


AUTH response

Following a successful authorisation, your system will be returned an AUTH response with the following structure:

  u 'requestreference': u 'A0bxh87wt',
    u 'version': u '1.00',
    u 'responses': [{
      u 'transactionstartedtimestamp': u '2016-12-07 11:32:44',
        u 'livestatus': u '0',
        u 'settleduedate': u '2016-12-07',
        u 'errorcode': u '0',
        u 'transactionreference': u '23-9-80001',
        u 'merchantname': u 'Test Merchant',
        u 'paymenttypedescription': u 'CASHTOCODE',
        u 'baseamount': u '2500',
        u 'accounttypedescription': u 'ECOM',
        u 'requesttypedescription': u 'AUTH',
        u 'currencyiso3a': u 'EUR',
        u 'errormessage': u 'Ok',
        u 'operatorname': u '[email protected]',
        u 'settlestatus': u '10',
        u 'redirecturl': u ''
array(3) {
  ["requestreference"] => string(9) "A3579dkvx"
  ["version"] => string(4) "1.00"
  ["responses"] => array(1) {
    [0] => array(15) {
      ["transactionstartedtimestamp"] => string(19) "2016-12-07 11:32:44",
      ["livestatus"] => string(1) "0",
      ["settleduedate"] => string(10) "2016-12-07",
      ["errorcode"] => string(1) "0",
      ["transactionreference"] => string(10) "23-9-80001",
      ["merchantname"] => string(13) "Test Merchant",
      ["paymenttypedescription"] => string(10) "CASHTOCODE",
      ["baseamount"] => string(4) "2500",
      ["accounttypedescription"] => string(4) "ECOM",
      ["requesttypedescription"] => string(4) "AUTH",
      ["currencyiso3a"] => string(3) "EUR",
      ["errormessage"] => string(2) "Ok",
      ["operatorname"] => string(23) "[email protected]",
      ["settlestatus"] => string(2) "10",
      ["redirecturl"] => string(23) ""
  "requestreference": "W23-fjgvn3d8",
  "version": "1.00",
  "response": [{
    "transactionstartedtimestamp": "2016-12-07 11:32:44",
    "livestatus": "0",
    "settleduedate": "2016-12-07",
    "errorcode": "0",
    "transactionreference": "23-9-80001",
    "merchantname": "Test Merchant",
    "paymenttypedescription": "CASHTOCODE",
    "baseamount": "2500",
    "accounttypedescription": "ECOM",
    "requesttypedescription": "AUTH",
    "currencyiso3a": "EUR",
    "errormessage": "Ok",
    "operatorname": "[email protected]",
    "settlestatus": "10",
    "redirecturl": ""
  "secrand": "zO9"


Field specification


Field name Type Length Request Response Description
accounttypedescription Alpha 20 Only e-commerce (“ECOM”) is supported for Cash to Code.
baseamount Numeric 5 The amount of the transaction in base units, with no commas or decimal points, so €10 is submitted as 1000. This value must be greater than zero.
billingalias Alphanumeric 100 An alias provided by you, to identify the customer.
billingcountryiso2a Alpha 2 The country for the customer’s billing address. This will need to be in ISO2A format. Click here for a full list of country codes.
billingdob Date YYYY-MM-DD 10 The customer’s date of birth.
billingfirstname Alphanumeric including
127 The customer’s billing first name.
billinglastname The customer’s billing last name.
billingid Alphanumeric 100 An id provided by you, used to uniquely identify each customer. Returning customers must be assigned the same unique id as during their previous payment.
billingreturning Numeric 1 Indicates if customer has previously completed a payment with Cash to Code:

“1” = True  –OR–  “0” = False

currencyiso3a Alpha 3 For Cash to Code, only “EUR” is permitted.
errorurlredirect URL 2048 The customer may be redirected to this page in the event of an error.
paymenttypedescription Alpha 20 The payment type must be set to “CASHTOCODE”.
redirecturl URL 255 Redirect the customer’s browser to this URL, to allow them to complete the payment on the Cash to Code-hosted pages.
sitereference Alphanumeric including
50 The site reference relates to your individual account which you received on setup. If you do not know your site reference, please contact our Support team.
successfulurlredirect URL 2048 If the customer completes their payment, they can click through to this success page hosted on your server.


Handling the response

Following a successful AUTH:

The settlestatus value will remain “10” until the customer completes the payment.

In order to proceed with the payment, you must redirect the customer’s browser to the redirecturl returned in the AUTH response, as explained below.


If the errorcode is NOT “0” or the settlestatus is NOT “10”:

When interpreting the response, we recommend following our best practices.


2. Redirect to Cash to Code

If the AUTH response returned indicates the request was successful (errorcode is “0”), redirect the customer to the redirecturl returned in the response by following the instructions below.


Process overview





3. Settlement

The settlestatus will remain with value “10” (indicating settlement has yet to be completed) until the customer goes to a retail outlet and completes the payment with cash. If the customer never completes the payment, the settlestatus will remain as “10” indefinitely.


For this reason, we strongly advise against providing goods or services to the customer until the settlestatus has been updated to “100”, indicating the customer has completed the payment.


Redirect back to your website

If the customer still has their browser open on Cash to Code’s pages after they have paid in cash and the payment has been completed, they will be provided with the option to click through to the page specified in the successfulurlredirect field. On this page, we recommend displaying a success message.

As soon as the customer receives their unique code from Cash to Code, they are free to close their browser, and as such, may not view the page specified in the successfulurlredirect field after they have paid at the retail location.


URL notifications

Updates on the status of Cash to Code payments are performed on an hourly basis. To keep you informed of developments, we recommend contacting our Support team and request that URL notifications for Cash to Code are enabled on your account.

URL notifications are sent in the following scenarios:

You will be asked to provide a destination endpoint URL
(e.g. “”), along with a list of fields you would like to be included in the notification.


Configuring the authorisation notification

We recommend including at least the following fields in URL notifications sent on authorisation:


Configuring the settlement notification

After the customer completes the payment by going to a retail outlet and paying in cash, Secure Trading will submit a URL notification to your system. We recommend including the following fields in URL notifications sent on settlement:


Check the notification

You will need to check the contents of each notification received and respond accordingly by following the processes outlined in the URL notifications section on the Action types page. In particular, you will need to look at the updated settlestatus value:



Additional notes