Introduction
This is a simple guide in how integrate your website with the Blink gateway so that you can accept payments straight onto your website. If you require a more advanced integration, please contact our integrations team.
Integration Types
Hosted (1.3.1 page 7)
Direct
Authentication
To ensure the transactions are being processed correctly, you must use you gateway merchant ID and its corresponding unique signature key. The signature must be encrypted before sending the request.
Request
Required Fields
Field Name | Description | |
---|---|---|
1 | Merchant ID | Your Merchant Gateway ID (Can be found on Take a Payment and Request a Payment) |
2 | signature | Unique key related to your merchant ID, the signature key is encrypted before the request is sent. Please contact our support team to find out your signature key. |
3 | action | The Action requested. Typically, it is SALE |
4 | amount | The Amount of the transaction |
5 | type | 1 - E-commerce (ECOM) - standard online payments. 2 - Mail Order Telephone Order (MOTO) - the merchant is inputting the card details. 9 - Continuous Authority (CA) - for recurring and rerunning transactions. |
6 | countryCode | Merchant’s Location (for UK 826) |
7 | currencyCode | Transaction currency code (for UK 826) |
8 | cardNumber | The primary account number (PAN) as printed on the front of the payment card. Digits and spaces only - Direct Integration Only |
9 | cardExpiryMonth | The card’s expiry month from 1 to 12. - Direct Integration Only |
10 | cardExpiryYear | The card’s expiry year from 00 to 99. - Direct Integration Only |
11 | cardCVV | Payment card’s security number. The 3-digit number printed on the signature strip. - Direct Integration Only |
Recommended (Optional) Fields
Field Name | Description | |
---|---|---|
1 | transactionUnique | You can supply a unique identifier for this transaction. This is an added security feature to combat transaction spoofing. |
2 | customerName | Name of Customer |
3 | customerEmail | Email Address of customer |
4 | customerAddress | Address of customer - may be required depending on AVS checks |
5 | customerPostCode | Post code of customer - may be required depending on AVS checks |
6 | orderRef | Free format text field to store order details, reference numbers, etc. for the Merchant’s records. Essentially, an additional identifier. |
7 | redirectURL | URL to which the hosted form will redirect the Customer’s browser after the transaction has been completed. The URL must be fully qualified and include at least the scheme and host components. (Only relevant to Hosted integration) |
Advanced Fields
Response
Full Example (p.321)
<?PHP //Merchant ID $merchantID = '100001' // Merchant Signature key, $key = 'Circle4Take40Idea'; // Gateway URL $url = 'https://gateway2.blinkpayment.co.uk/hosted/modal'; if (!isset($_POST['responseCode'])) { // Send request to gateway // Request $req = array( 'merchantID' => $merchantID, 'action' => 'SALE', 'type' => 1, 'countryCode' => 826, 'currencyCode' => 826, 'amount' => 1001, 'orderRef' => 'Test purchase', 'transactionUnique' => uniqid(), 'redirectURL' => ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], ); // Create the signature using the function called below. $req['signature'] = createSignature($req, $key); echo '<form action="' . htmlentities($url) . '" method="post">' . PHP_EOL; foreach ($req as $field => $value) { echo ' <input type="hidden" name="' . $field . '" value="' . htmlentities($value) . '">' . PHP_EOL; } echo ' <input type="submit" value="Pay Now">' . PHP_EOL; echo '</form>' . PHP_EOL; // Check the return signature if (!$signature || $signature !== createSignature($res, $key)) { // You should exit gracefully die('Sorry, the signature check failed'); } // Check the response code if ($res['responseCode'] === "0") { echo "<p>Thank you for your payment.</p>"; } else { echo "<p>Failed to take payment: " . htmlentities($res['responseMessage']) . "</p>"; } } // Function to create a message signature function createSignature(array $data, $key) { // Sort by field name ksort($data); // Create the URL encoded signature string $ret = http_build_query($data, '', '&'); // Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A) $ret = str_replace(array('%0D%0A', '%0A%0D', '%0D'), '%0A', $ret); // Hash the signature string and the key together return hash('SHA512', $ret . $key); } ?>