Skip to main content

Starting a BLIK One Click Transaction

BLIK One Click allows a returning user to pay without entering a BLIK code. The user remembers the shop in their banking application during a payment with a BLIK code, then confirms subsequent payments in the banking application.

Transaction parameters​

Include the following parameters in the options array:

  • blikAliasUID – UUID assigned to a specific user, for example 550e8400-e29b-41d4-a716-446655440000. Store the UUID with the user account and reuse it for that user subsequent BLIK One Click transactions.
  • blikAliasLabel – required whenever blikAliasUID is sent. A name that allows the user to identify the account in the Shop system after adding the Shop to the memorized ones in the banking application, for example a masked email address or customer number. The label is especially important when the user has more than one account in the Shop system. If the label contains personal data (email address), the data must be partially masked before being sent, for example ja…ki@em…pl
  • blikCode – 6-digit BLIK code, used for the first payment when registering the alias. Omit it when paying with an already registered alias.
  • ip – payer IP address.
  • companyAddressStreet – company address (street, building number, apartment number), displayed in the banking application (optional).
  • companyAddressCity – company address (city), displayed in the banking application (optional).

For subsequent payments, send blikAliasUID, blikAliasLabel and ip in options without blikCode. blikAliasLabel is required and must be sent together with blikAliasUID. The standard transaction fields are still required.

The response contains the standard transaction initiation response object. The shop system should wait for an asynchronous transaction status notification instead of redirecting the user using redirectUrl. Successfully initiating a transaction does not mean that the payment has completed. The user must confirm it in their banking application.

First payment with a BLIK code​

Assign a UUID to the user and submit it as blikAliasUID together with the required blikAliasLabel and the BLIK code. The user confirms the payment and remembers the shop in their banking application. Keep the UUID and the transaction ID (id, used as orderId in the alias endpoints) associated with the user.

Example request​

<?php

$shopId = ""; // Payment Point ID
$secretPhrase = ""; // Payment Point Secret
$mainUrl = "https://pay.cashbill.pl/ws/rest";
$blikAliasUID = "550e8400-e29b-41d4-a716-446655440000"; // UUID assigned to this user
$blikAliasLabel = "cu...er@ex...om"; // Required account label shown in the banking application


$transaction = [
"title" => "Example BLIK One Click #1",
"amount" => [
"value" => 1.23,
"currencyCode" => "PLN"
],
"personalData" => [
"email" => "example@mail.com"
],
"returnUrl" => "https://cashbill.pl",
"description" => "Transaction description example",
"additionalData" => "#1",
"paymentChannel" => "blik_7517",
"options" => [
["name" => "blikAliasUID", "value" => $blikAliasUID],
["name" => "blikAliasLabel", "value" => $blikAliasLabel],
["name" => "ip", "value" => "XXX.X.XXX.XX"],
["name" => "blikCode", "value" => "123456"],
["name" => "companyAddressCity", "value" => "Katowice"],
["name" => "companyAddressStreet", "value" => "ul. Sobieskiego 2"]
]
];


$signData = $transaction['title']
. $transaction['amount']['value']
. $transaction['amount']['currencyCode']
. $transaction['returnUrl']
. $transaction['description']
. $transaction['additionalData']
. $transaction['paymentChannel']
. $transaction['personalData']['email'];

foreach ($transaction['options'] as $option) {
$signData .= $option['name'] . $option['value'];
}

$transaction['sign'] = sha1($signData . $secretPhrase);


$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "{$mainUrl}/payment/{$shopId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode($transaction)
]);

$response = json_decode(curl_exec($ch));
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode != 200) {
echo "Error: " . $response->errorMessage;
} else {
echo "Transaction ID: " . $response->id;
}