Activate BLIK Recurring Payments in Model O
Model O is the most comprehensive model, offering greater flexibility in processing recurring transactions. The entire recurring payment process is managed by the merchant.
In BLIK Recurring Payments the user enters a BLIK code and approves activation in the banking application. Subsequent merchant-initiated payments are authorized automatically by the bank without user confirmation. The maximum single recurring transaction is 2 000 PLN.
Model O requires merchant configuration in the BLIK system. Contact customer support for details.
Transaction parameters
Include the following parameters in the options array:
blikAliasUID– UUID assigned to a specific recurring payment, for example550e8400-e29b-41d4-a716-446655440000. Store the UUID with the user account and recurring payment and reuse it for subsequent transactions under that recurring payment.blikAliasLabel– required wheneverblikAliasUIDis 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…plblikCode– 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, see Subsequent recurring transactions.
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. During activation, the user confirms it in their banking application.
Activate recurring payments with a BLIK code
Assign a UUID to the recurring payment and submit it as blikAliasUID together with the required blikAliasLabel and the BLIK code. The user confirms activation in their banking application. Keep the UUID and the transaction ID (id, used as orderId in the alias endpoints) associated with the user and recurring payment.
The example charges 49.99 PLN for the first subscription period.
Example request
- Request
- Response (Success)
- Response (Error)
<?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 recurring payment
$blikAliasLabel = "cu...er@ex...om Video"; // Required account label shown in the banking application
$transaction = [
"title" => "Example BLIK Recurring Payment #1",
"amount" => [
"value" => 49.99,
"currencyCode" => "PLN"
],
"personalData" => [
"email" => "example@mail.com"
],
"returnUrl" => "https://cashbill.pl",
"description" => "Transaction description example",
"additionalData" => "#1",
"paymentChannel" => "blik_7517_RC",
"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;
}
{
"id": "string"
}
{
"errorMessage": "Cannot start transaction: ER_WRONG_TICKET Ticket 123456 is wrong"
}