Example Integration Code

Quick Find

Go straight to the section you need.

1.0 Gateway Integration →

1.1 Introduction

1.2 Terminology

1.3 Integration Methods

1.4 Integration Libraries

1.5 Security and Compliance

1.6 Prerequisites

1.7 Integration Details

1.8 Authentication

1.9 Supported Actions

2.0 New Transactions →

2.1 Request Fields

2.2 Response Fields

3.0 Management Requests →

3.1 Request Fields

3.2 Response Fields

4.0 AVS/CV2 Checking →

4.1 Background

4.2 Benefits and Limitations

4.3 Request Fields

4.4 Response Fields

5.0 3-D Secure Authentication →

5.1 Background

5.2 Benefits and Limitations

5.3 Hosted Implementation

5.4 Direct Implementation

5.5 Request Fields

5.6 Response Fields

5.7 Advanced Features

11 Receipts and Notifications →

11.1 Background

11.2 Customer Email Receipts

11.3 Request Fields

11.4 Response Fields

17 Advanced Data →

17.1 Customer Request Fields

17.2 Merchant Request Fields

17.3 Supplier Request Fields

17.4 Delivery Request Fields

17.5 Receiver Request Fields

17.6 Shipping Request Fields

17.7 Device Information Fields

 

19 Gateway Wallet → 

19.1 Background

19.2 Benefits and Limitation

19.3 Hosted

19.4 Direct Implentation

19.5 Request Fields

19.6 Response Fields

 

26 Digital Wallet Transactions →

26.1 Background

26.2 Benefits and Limitations

26.3 Configuration

26.4 Hosted Implementation

26.5 Direct Implementation

26.6 Request Fields

26.7 Response Fields

26.8 Digital Wallet Tokens

Appendix

A-1 Response Codes

A-1.1 Authorisation Response Codes

A-1.2 Gateway Response Codes

A-2 AVS / CV2 Check Response Codes

A-3 3-D Secure Enrolment/Authentication Codes

A-4 3-D Secure Enrolment/Authentication Only

A-9 Duplicate Transaction Checking

A-10 Capture Delay

A-11 Card Identification

A-12 Integration Testing

12.1 Test Amounts

12.2 Test Cards

12.3 3-D Secure Testing

 

A-13 Sample Signature Calculation

A-14 Transaction Life cycle

A-14.1 Authorise, Capture and Settlement

A-14.2 Transaction States

A-15 Transaction types

A-15.1 E-commerce (ECOM)

A-15.2 Mail Order/Telephone Order (MOTO)

A-15.3 Continuous Authority (CA)

 

A-16 Payment Tokenisation

A-16.1 PREAUTH, SALE, REFUND, VERIFY requests

A-16.2 REFUND_SALE requests

A-16.3 CANCEL or CAPTURE requests

A-16.4 QUERY requests

A-16.5 SALE or REFUND Referred Authorisation requests

 

A-18 PSD2 SCA Compliance

A-18.1 Obtaining Strong Customer Authentication

A-18.2 Exemptions to Strong Customer Authentication

A-18.3 SCA Using 3-D Secure

 

A-19 Hosted Payment Page Options

A-20 Integration Libraries

A-20.1 Gateway Integration Library

A-20.2 Hosted Payment Page Library

A-20.3 Hosted Payment Fields Library

 

A-21 Example HTTP Requests

A-21.1 Hosted Integration

A-21.2 Direct Integration

A-21.3 Batch Integration

 

A-22 Example Integration Code

A-22.1 Hosted Integration

A-22.2 Direct Integration

A-22.3 Batch Integration

 

A-23 Example Library Code

A-23.1 Gateway Integration Library

A-23.2 Hosted Payment Page Library

A-23.3 Hosted Payment Fields Library

A-22 Example Integration Code

The follow section provides samples of how to integrate with the Gateway using the PHP scripting language to communicate directly with the API without the use of any our SDKs.

A-22.1 Hosted Integration

A-22.1.1 Sale Transaction

 

The following example PHP code shows how to send a SALE transaction:

 

  1. <?PHP 
  2. // Signature key entered on MMS. The demo account is fixed to this value, 
  3. $key = ‘Circle4Take40Idea’
  4. // Gateway URL 
  5. $url = ‘https://gateway.swipen.com/hosted/’
  6. if (!isset($_POST[‘responseCode’])) { 
  7. // Send request to gateway 
  8. // Request 
  9. $req = array
  10. ‘merchantID’ => ‘100001’
  11. ‘action’ => ‘SALE’
  12. ‘type’ => 1, 
  13. ‘countryCode’ => 826, 
  14. ‘currencyCode’ => 826, 
  15. ‘amount’ => 1001, 
  16. ‘orderRef’ => ‘Test purchase’
  17. ‘transactionUnique’ => uniqid(), 
  18. ‘redirectURL’ => ($_SERVER[‘HTTPS’] == ‘on’ ? ‘https’ : ‘http’) . ‘://’ . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’], 
  19. ); 
  20. // Create the signature using the function called below. 
  21. $req[‘signature’] = createSignature($req, $key); 
  22. echo ‘<form action=”‘ . htmlentities($url) . ‘” method=”post”>’ . PHP_EOL; 
  23. foreach ($req as $field => $value) { 
  24. echo ‘ <input type=”hidden” name=”‘ . $field . ‘” value=”‘ . htmlentities($value) . ‘”>’ . PHP_EOL; 
  25. echo ‘ <input type=”submit” value=”Pay Now”>’ . PHP_EOL; 
  26. echo ‘</form>’ . PHP_EOL; 
  27. // Check the return signature 
  28. if (!$signature || $signature !== createSignature($res, $key)) { 
  29. // You should exit gracefully 
  30. die(‘Sorry, the signature check failed’); 
  31. // Check the response code 
  32. if ($res[‘responseCode’] === “0”) { 
  33. echo “<p>Thank you for your payment.</p>”
  34. } else
  35. echo “<p>Failed to take payment: ” . htmlentities($res[‘responseMessage’]) . “</p>”
  36. // Function to create a message signature 
  37. function createSignature(array $data, $key) { 
  38. // Sort by field name 
  39. ksort($data); 
  40. // Create the URL encoded signature string 
  41. $ret = http_build_query($data, , ‘&’); 
  42. // Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A) 
  43. $ret = str_replace(array(‘%0D%0A’, ‘%0A%0D’, ‘%0D’), ‘%0A’, $ret); 
  44. // Hash the signature string and the key together 
  45. return hash(‘SHA512’, $ret . $key); 
  46. ?> 

A-22.2 Direct Integration

A-22.2.1 Sale Transaction (with 3-D Secure)

 

The following example PHP code shows how to send a SALE transaction with support for 3-D Secure: 

 

  1. <?PHP 
  2. // Signature key entered on MMS. The demo account is fixed to this value, 
  3. $key = ‘Circle4Take40Idea’
  4. // Gateway URL 
  5. $url = ‘https://gateway.swipen.com/direct/’
  6. // Setup PHP session as use it to store data between 3DS steps 
  7. if (isset($_GET[‘sid’])) { 
  8. session_id($_GET[‘sid’]); 
  9. session_start(); 
  10. // Compose current page URL (removing any sid and acs parameters) 
  11. $pageUrl = ((isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == ‘on’) ? ‘https://’ : ‘http://’
  12. . $_SERVER[‘SERVER_NAME’] . ($_SERVER[‘SERVER_PORT’] != ’80’ ? ‘:’ . $_SERVER[‘SERVER_PORT’] :
  13. . preg_replace(‘/(sid=[^&]+&?)|(acs=1&?)/’, , $_SERVER[‘REQUEST_URI’]); 
  14. // Add back the correct sid parameter (used as session cookie may not be passed when the page is redirected from an IFRAME) 
  15. $pageUrl .= (strpos($pageUrl, ‘?’) === false ? ‘?’ : ‘&’) . ‘sid=’ . urlencode(session_id()); 
  16. // If ACS response into the IFRAME then redirect back to parent window 
  17. if (!empty($_GET[‘acs’])) { 
  18. echo silentPost($pageUrl, array(‘threeDSResponse’ => $_POST), ‘_parent’); 
  19. exit(); 
  20. if (!isset($_POST[‘threeDSResponse’])) { 
  21. // Initial request 
  22. // Gather browser info – can be done at any time prior to the checkout 
  23. if (!isset($_POST[‘browserInfo’])) { 
  24. echo collectBrowserInfo(); 
  25. exit(); 
  26. // Direct Request 
  27. $req = array
  28. ‘merchantID’ => 100001, 
  29. ‘action’ => ‘SALE’
  30. ‘type’ => 1, 
  31. ‘currencyCode’ => 826, 
  32. ‘countryCode’ => 826, 
  33. ‘amount’ => 1001, 
  34. ‘cardNumber’ => ‘4012001037141112’
  35. ‘cardExpiryMonth’ => 12, 
  36. ‘cardExpiryYear’ => 15, 
  37. ‘cardCVV’ => ‘083’
  38. ‘customerName’ => ‘Test Customer’
  39. ‘customerEmail’ => ‘test@testcustomer.com’
  40. ‘customerAddress’ => ’16 Test Street’
  41. ‘customerPostCode’ => ‘TE15 5ST’
  42. ‘orderRef’ => ‘Test purchase’
  43. // The following fields are mandatory for 3DS v2
  44. ‘remoteAddress’ => $_SERVER[‘REMOTE_ADDR’], 
  45. ‘threeDSRedirectURL’ => $pageUrl . ‘&acs=1’
  46. ); 
  47. // Add the browser info as it is mandatory for 3DS v2 
  48. $req += $_POST[‘browserInfo’]; 
  49. } else
  50. // 3DS continuation request 
  51. $req = array
  52. ‘threeDSRef’ => $_SESSION[‘threeDSRef’], 
  53. ‘threeDSResponse’ => $_POST[‘threeDSResponse’], 
  54. ); 
  55. // Create the signature using the function called below. 
  56. $req[‘signature’] = createSignature($req, $key); 
  57. // Initiate and set curl options to post to the gateway 
  58. $ch = curl_init($url); 
  59. curl_setopt($ch, CURLOPT_POST, true); 
  60. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($req)); 
  61. curl_setopt($ch, CURLOPT_HEADER, false); 
  62. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
  63. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  64. // Send the request and parse the response 
  65. parse_str(curl_exec($ch), $res); 
  66. // Close the connection to the gateway 
  67. curl_close($ch); 
  68. // Extract the return signature as this isn’t hashed 
  69. $signature = null; 
  70. if (isset($res[‘signature’])) { 
  71. $signature = $res[‘signature’]; 
  72. unset($res[‘signature’]); 
  73. // Check the return signature 

100.if (!$signature || $signature !== createSignature($res, $key)) { 

  1. // You should exit gracefully 
  2. die(‘Sorry, the signature check failed’); 

103.} 

105.// Check the response code 

106.if ((int)$res[‘responseCode’] === 65802) { 

  1. // Send request to the ACS server displaying response in an IFRAME 
  2. // Render an IFRAME to show the ACS challenge (hidden for fingerprint method) 
  3. $style = (isset($res[‘threeDSRequest’][‘threeDSMethodData’]) ? ‘display: none;’ : ); 
  4. echo “<iframe name=\”threeds_acs\” style=\”height:420px; width:420px; {$style}\”></iframe>\n”
  5. // Silently POST the 3DS request to the ACS in the IFRAME 
  6. echo silentPost($res[‘threeDSURL’], $res[‘threeDSRequest’], ‘threeds_acs’); 
  7. // Remember the threeDSRef as need it when the ACS responds 
  8. $_SESSION[‘threeDSRef’] = $res[‘threeDSRef’]; 

119.} else if ((int)$res[‘responseCode’] === 0) { 

  1. echo “<p>Thank you for your payment.</p>”

121.} else

  1. echo “<p>Failed to take payment: ” . htmlentities($res[‘responseMessage’]) . “</p>”

123.} 

125.// Function to create a message signature

126.function createSignature(array $data, $key) { 

  1. // Sort by field name 
  2. ksort($data); 
  3. // Create the URL encoded signature string 
  4. $ret = http_build_query($data, , ‘&’); 
  5. // Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A) 
  6. $ret = str_replace(array(‘%0D%0A’, ‘%0A%0D’, ‘%0D’), ‘%0A’, $ret); 
  7. // Hash the signature string and the key together 
  8. return hash(‘SHA512’, $ret . $key); 

138.} 

140.// Return HTML to render a hidden form used to collect some browser details 

141.function collectBrowserInfo(array $options = null) { 

  1. $form_attrs = ‘id=”collectBrowserInfo” method=”post” action=”?”‘
  2. if (isset($options[‘formAttrs’])) { 
  3. $form_attrs .= $options[‘formAttrs’]; 
  4. $device_data = array
  5. ‘deviceChannel’ => ‘browser’
  6. ‘deviceIdentity’ => (isset($_SERVER[‘HTTP_USER_AGENT’]) ? htmlentities($_SERVER[‘HTTP_USER_AGENT’]) : null), 
  7. ‘deviceTimeZone’ => ‘0’
  8. ‘deviceCapabilities’ =>
  9. ‘deviceScreenResolution’ => ‘1x1x1’
  10. ‘deviceAcceptContent’ => (isset($_SERVER[‘HTTP_ACCEPT’]) ? htmlentities($_SERVER[‘HTTP_ACCEPT’]) : null), 
  11. ‘deviceAcceptEncoding’ => (isset($_SERVER[‘HTTP_ACCEPT_ENCODING’]) ? htmlentities($_SERVER[‘HTTP_ACCEPT_ENCODING’]) : null), 
  12. ‘deviceAcceptLanguage’ => (isset($_SERVER[‘HTTP_ACCEPT_LANGUAGE’]) ? htmlentities($_SERVER[‘HTTP_ACCEPT_LANGUAGE’]) : null), 
  13. ‘deviceAcceptCharset’ => (isset($_SERVER[‘HTTP_ACCEPT_CHARSET’]) ? htmlentities($_SERVER[‘HTTP_ACCEPT_CHARSET’]) : null), 
  14. ); 
  15. $form_fields = fieldToHtml(‘browserInfo’, $device_data); 
  16. if (isset($options[‘formData’])) { 
  17. foreach ((array)$options[‘formData’] as $name => $value) { 
  18. $form_fields .= fieldToHtml($name, $value); 
  19. $ret = <<<EOS 
  20. <form {$form_attrs}> 
  21. {$form_fields} 
  22. </form> 
  23. <script> 
  24. var screen_width = (window && window.screen ? window.screen.width : ‘0’); 
  25. var screen_height = (window && window.screen ? window.screen.height : ‘0’); 
  26. var screen_depth = (window && window.screen ? window.screen.colorDepth : ‘0’); 
  27. var identity = (window && window.navigator ? window.navigator.userAgent : ); 
  28. var language = (window && window.navigator ? (window.navigator.language ? window.navigator.language : window.navigator.browserLanguage) : ); 
  29. var timezone = (new Date()).getTimezoneOffset(); 
  30. var java = (window && window.navigator ? navigator.javaEnabled() : false); 
  31. var fields = document.forms.collectBrowserInfo.elements; 
  32. fields[‘browserInfo[deviceIdentity]’].value = identity; 
  33. fields[‘browserInfo[deviceTimeZone]’].value = timezone; 
  34. fields[‘browserInfo[deviceCapabilities]’].value = ‘javascript’ + (java ? ‘,java’ : ); 
  35. fields[‘browserInfo[deviceAcceptLanguage]’].value = language; 
  36. fields[‘browserInfo[deviceScreenResolution]’].value = screen_width + ‘x’ + screen_height + ‘x’ + screen_depth; 
  37. window.setTimeout(‘document.forms.collectBrowserInfo.submit()’, 0); 
  38. </script> 

189.EOS; 

  1. return $ret; 

192.} 

194.// Render HTML to silently POST data to URL in target brower window 

195.function silentPost($url = ‘?’, array $post = null, $target = ‘_self’) { 

  1. $url = htmlentities($url); 
  2. $target = htmlentities($target); 
  3. $fields =
  4. if ($post) { 
  5. foreach ($post as $name => $value) { 
  6. $fields .= fieldToHtml($name, $value); 
  7. $ret = ” 
  8. <form id=\“silentPost\” action=\”{$url}\” method=\”post\” target=\”{$target}\”
  9. {$fields} 
  10. <noscript><input type=\“submit\” value=\”Continue\”></noscript 
  11. </form> 
  12. <script> 
  13. window.setTimeout(‘document.forms.silentPost.submit()’, 0); 
  14. </script> 
  15. “; 
  16. return $ret; 

218.} 

220.// Return a value as hidden HTML FORM fields 

221.function fieldToHtml($name, $value) { 

  1. $ret =
  2. if (is_array($value)) { 
  3. foreach ($value as $n => $v) { 
  4. $ret .= fieldToHtml($name . ‘[‘ . $n . ‘]’, $v); 
  5. } else
  6. // Convert all applicable characters or none printable characters to HTML entities 
  7. $value = preg_replace_callback(‘/[\x00-\x1f]/’, function($matches) { return ‘&#’ . ord($matches[0]) . ‘;’; }, htmlentities($value, ENT_COMPAT, ‘UTF-8’, true)); 
  8. $ret = “<input type=\”hidden\” name=\”{$name}\” value=\”{$value}\” />\n”
  9. return $ret; 

234.} 

237.?> 

A-22.2.2 Sale Transaction (without 3-D Secure)

 

The following sample PHP code shows how to send a SALE transaction without support for 3-D Secure: 

 

  1. <?PHP 
  2. // Signature key entered on MMS. The demo account is fixed to this value, 
  3. $key = ‘Circle4Take40Idea’
  4. // Gateway URL 
  5. $url = ‘https://gateway.swipen.com/direct/’
  6. // Request 
  7. $req = array
  8. ‘merchantID’ => ‘100001’
  9. ‘action’ => ‘SALE’
  10. ‘type’ => 1, 
  11. ‘countryCode’ => 826, 
  12. ‘currencyCode’ => 826, 
  13. ‘amount’ => 1001, 
  14. ‘cardNumber’ => ‘4012001037141112’
  15. ‘cardExpiryMonth’ => 12, 
  16. ‘cardExpiryYear’ => 15, 
  17. ‘cardCVV’ => ‘083’
  18. ‘customerName’ => ‘Test Customer’
  19. ‘customerEmail’ => ‘test@testcustomer.com’
  20. ‘customerPhone’ => ‘+44 (0) 123 45 67 890’
  21. ‘customerAddress’ => ’16 Test Street’
  22. ‘customerPostCode’ => ‘TE15 5ST’
  23. ‘orderRef’ => ‘Test purchase’
  24. ‘transactionUnique’ => uniqid(), 
  25. ); 
  26. // Create the signature using the function called below. 
  27. $req[‘signature’] = createSignature($req, $key); 
  28. // Initiate and set curl options to post to the gateway 
  29. $ch = curl_init($url); 
  30. curl_setopt($ch, CURLOPT_POST, true); 
  31. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($req)); 
  32. curl_setopt($ch, CURLOPT_HEADER, false); 
  33. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
  34. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  35. // Send the request and parse the response 
  36. parse_str(curl_exec($ch), $res); 
  37. // Close the connection to the gateway 
  38. curl_close($ch); 
  39. // Extract the return signature as this isn’t hashed 
  40. $signature = null; 
  41. if (isset($res[‘signature’])) { 
  42. $signature = $res[‘signature’]; 
  43. unset($res[‘signature’]); 
  44. // Check the return signature 
  45. if (!$signature || $signature !== createSignature($res, $key)) { 
  46. // You should exit gracefully 
  47. die(‘Sorry, the signature check failed’); 
  48. // Check the response code 
  49. if ($res[‘responseCode’] === “0”) { 
  50. echo “<p>Thank you for your payment.</p>”
  51. } else
  52. echo “<p>Failed to take payment: ” . htmlentities($res[‘responseMessage’]) . “</p>”
  53. // Function to create a message signature 
  54. function createSignature(array $data, $key) { 
  55. // Sort by field name 
  56. ksort($data); 
  57. // Create the URL encoded signature string 
  58. $ret = http_build_query($data, , ‘&’); 
  59. // Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A) 
  60. $ret = str_replace(array(‘%0D%0A’, ‘%0A%0D’, ‘%0D’), ‘%0A’, $ret); 
  61. // Hash the signature string and the key together 
  62. return hash(‘SHA512’, $ret . $key); 
  63. ?>

A-22.3 Batch Integration

A-22.3.1 Batch Submission 

The following example PHP code shows how to send a batch request containing three SALE transactions: 

 

  1. <?PHP 
  2. // Signature key entered on MMS. The demo account is fixed to this value, 
  3. $key = ‘Circle4Take40Idea’
  4. // Gateway URL 
  5. $url = ‘https://gateway.swipen.com/batch/’
  6. // Create a unique multipart boundary 
  7. $boundary = uniqid(); 
  8. // Requests 
  9. $reqs = array
  10. array
  11. ‘merchantID’ => 100001, 
  12. ‘action’ => ‘SALE’
  13. ‘type’ => 1, 
  14. ‘currencyCode’ => 826, 
  15. ‘countryCode’ => 826, 
  16. ‘amount’ => 1001, 
  17. ‘cardNumber’ => ‘4012001037141112’
  18. ‘cardExpiryMonth’ => 12, 
  19. ‘cardExpiryYear’ => 15, 
  20. ‘cardCVV’ => ‘083’
  21. ‘customerName’ => ‘Test Customer’
  22. ‘customerEmail’ => ‘test@testcustomer.com’
  23. ‘customerAddress’ => ’16 Test Street’
  24. ‘customerPostCode’ => ‘TE15 5ST’
  25. ‘orderRef’ => ‘Test purchase’
  26. ‘transactionUnique’ => uniqid(), 
  27. ‘threeDSRequired’ => ‘N’
  28. ‘avscv2CheckRequired’ => ‘N’
  29. ), 
  30. array
  31. ‘merchantID’ => 100001, 
  32. ‘action’ => ‘SALE’
  33. ‘type’ => 1, 
  34. ‘currencyCode’ => 826, 
  35. ‘countryCode’ => 826, 
  36. ‘amount’ => 2002, 
  37. ‘cardNumber’ => ‘4012001037141112’
  38. ‘cardExpiryMonth’ => 12, 
  39. ‘cardExpiryYear’ => 15, 
  40. ‘cardCVV’ => ‘083’
  41. ‘customerName’ => ‘Test Customer’
  42. ‘customerEmail’ => ‘test@testcustomer.com’
  43. ‘customerAddress’ => ’16 Test Street’
  44. ‘customerPostCode’ => ‘TE15 5ST’
  45. ‘orderRef’ => ‘Test purchase’
  46. ‘transactionUnique’ => uniqid(), 
  47. ‘threeDSRequired’ => ‘N’
  48. ‘avscv2CheckRequired’ => ‘N’
  49. ), 
  50. array
  51. ‘merchantID’ => 100001, 
  52. ‘action’ => ‘SALE’
  53. ‘type’ => 1, 
  54. ‘currencyCode’ => 826, 
  55. ‘countryCode’ => 826, 
  56. ‘amount’ => 3003, 
  57. ‘cardNumber’ => ‘4012001037141112’
  58. ‘cardExpiryMonth’ => 12, 
  59. ‘cardExpiryYear’ => 15, 
  60. ‘cardCVV’ => ‘083’
  61. ‘customerName’ => ‘Test Customer’
  62. ‘customerEmail’ => ‘test@testcustomer.com’
  63. ‘customerAddress’ => ’16 Test Street’
  64. ‘customerPostCode’ => ‘TE15 5ST’
  65. ‘orderRef’ => ‘Test purchase’
  66. ‘transactionUnique’ => uniqid(), 
  67. ‘threeDSRequired’ => ‘N’
  68. ‘avscv2CheckRequired’ => ‘N’
  69. ), 
  70. ); 
  71. // Create the batch parts 
  72. $parts = array(); 
  73. foreach ($reqs as $req) { 
  74. // Create the signature using the function called below. 
  75. $req[‘signature’] = createSignature($req, $key); 
  76. $parts[] = 
  77. “Content-Id: TX{$req[‘transactionUnique’]}\r\n”
  78. “Content-Type: application/x-www-form-urlencoded; charset=\”UTF-8\”\r\n”
  79. “\r\n” . 
  80. http_build_query($req); 
  81. // Join the parts together separated by the boundary string 
  82. $post = “\r\n–{$boundary}\r\n” . join(“\r\n–{$boundary}\r\n”, $parts) . “\r\n–{$boundary}–\r\n”
  83. // Initiate and set curl options to post to the gateway 
  84. $ch = curl_init($url); 
  85. curl_setopt($ch, CURLOPT_POST, true); 
  86. curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
  87. curl_setopt($ch, CURLOPT_HEADER, true); 
  88. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
  89. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

100.curl_setopt($ch, CURLOPT_HTTPHEADER, array

  1. ‘Content-type: multipart/mixed; charset=”UTF-8″; boundary=’ . $boundary, 
  2. ‘Content-length: ‘ . strlen($post), 

103.)); 

105.// Send the request 

106.$res = curl_exec($ch); 

108.// Normally would process the response here, but for this example just echo it out 

109.header (‘Content-Type: text/plain’); 

110.echo $res . PHP_EOL; 

112.// Close the connection to the gateway 

113.curl_close($ch); 

115.// Function to create a message signature 

116.function createSignature(array $data, $key) { 

  1. // Sort by field name 
  2. ksort($data); 
  3. // Create the URL encoded signature string 
  4. $ret = http_build_query($data, , ‘&’); 
  5. // Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A) 
  6. $ret = str_replace(array(‘%0D%0A’, ‘%0A%0D’, ‘%0D’), ‘%0A’, $ret); 
  7. // Hash the signature string and the key together 
  8. return hash(‘SHA512’, $ret . $key); 

128.} 

130.?>

Integrated Payments - connecting your till to your terminal

Integrated payments - connecting your EPOS till to your card terminal - enables your business to process payments faster and increase your profits.

There are many benefits to an integrated solution for almost all business types, most importantly, the removal of human error, giving you accurate reporting from all tills and terminals.

At Swipen, we offer Integrated Payments free of charge and you can use our Pay at Table or Pay at Counter software, or both if it suits your business:

Pay at Table

A software design with restaurants in mind:

Split the bill at the table

Automatic table closing

Integrated gratuity & reporting

Turn tables faster

More efficient payment

Pay at Counter

Suitable for most businesses, offering:

Faster payments

Shorter queues

Better conversion

Greater profits

COVID secure

Discover which terminal type is best for your business

Portable

Restaurants

Pubs

Cafes

Countertop

Bars

Clubs

Takeaways

Retail & Shops

Take your payments to the next level

E-Commerce Payment Solutions

With the arrival of Covid-19 into all our lives, online only payments are looking to have a bright future that’s here to stay.

At Swipen, we want to bust the myth that taking payments online is complicated, and help you
adapt to this changing world.

We offer two types of E-Commerce payment solution either directly integrated with your website or a hosted payment page.

Directly Integrated

Integrated into your own website

Completely customisable

Branded to your business

Customers stay on your website

150 currencies supported

Shopping carts

No long-term contract

Alternative payment methods, including: Alipay, Apple Pay, Google Pay, WeChatPay

Hosted Payment Page

Easy to set up

Take payments in minutes

Swipen branded

Data processed by Swipen

150 currencies supported

Shopping carts

No long-term contract

Alternative payment methods, including: Alipay, Apple Pay, Google Pay, WeChatPay

Take your payments to the next level

Virtual Terminal - Taking Payments over the Phone

Many businesses find it useful to take payments over the phone, whether you’re a travel agent
needing to take deposits, a mobile tradesperson, travelling salesperson, you have a call centre, or you don’t have a website to take payments online.

Swipen’s Virtual Terminal allows you to take card payments over the phone quickly and securely.

Our solution is a web portal that can be used on a desktop, tablet or mobile device.

Virtual Terminal Key Features

More secure than a card terminal - Completing the payment over the phone with full customer details reduces the risk of chargebacks or fraud.

Pay By Link - Send a payment link to complete the purchase or pay a balance. This is also a useful feature for customers who prefer to not give their details over the phone.

Capture Customer Details - The Virtual Terminal allows you to capture all the customer details you will need for your CRM or Booking Systems reducing the need for double inputting.

Control Permissions - Restrict user access to only certain functionality so you can control what your staff can process and see.

Take Payments anywhere - The Virtual Terminal is compatible to all devices and allows you to take payments from anywhere - office, home or on the move in a safe and secure way.

Ideal for call centres, travel agents, travelling salespeople, mobile tradespeople, restaurants for pre-bookings and parties, hotels for rooms and events, or any business that doesn’t have a website that customers can pay through.

Take your payments to the next level

Web & App Solutions - Order and Pay-at-Table Platform

With COVID regulations in force across the country, restaurants and pubs are adjusting the way they work to reduce the spread of this virus.

Swipen are also adapting to these changing times, and working with our expert partners, we can now offer order and pay-at-table platforms, allowing you to benefit from cashless and cardless payment options.

Our solutions can be either Web or App based and we provide the choice between
a ‘Simple Solution’ and a ‘Bespoke Solution’, depending on the size of your business

Bespoke Solution

The best option for individual pubs and restaurants, small chains, or if location offers a different menu:

Use your own branding

At table QR code or WiFi login

Bespoke rates and fees

Links to your EPOS till *

*Depending on the EPOS company

Simple Solution

Ideal for larger chains where every location requires exactly the same functionality and offers the same menu:

Custom built to fit your business

Customers can access the way you want

Links to both your till and kitchen

No training required

Working with Pizza Hut

Swipen have helped create a bespoke value-for money solution for Pizza Hut, and we could do the same for you.

Get in contact to find out more.

Take your payments to the next level

Tip Per Tap -Contactless Tipping System

With the dawn of cashless and touchless checkouts along with app ordering systems and pay online methods, many restaurants, bars, cafés and hotels are finding that their waiting staff are no longer able to receive cash or card tips.

Swipen has the perfect solution: the new ‘Tip Per Tap’ Contactless Tipping System

Directly Integrated

A dedicated terminal is placed in a prominent location in your restaurant.

The terminal is set to ‘donation’ and the debit amount is set at a specific figure. e.g. £2

Your happy customers simply tap their card, phone or watch against the terminal to leave a £2 tip.

They can tap multiple times to leave a larger amount

Works automatically without the need for a member of staff to supervise.

End-of-day report is separate, making it quicker and easier to share the total tips received between staff members.

How about a little Tip Per Tap

Read our blog all about our new Tip Per Tap Contactless Tipping System.

Get in contact to find out more.

Take your payments to the next level