Start a subsequent BLIK recurring payment
Use the blikAliasUID assigned to the same recurring payment and send the required blikAliasLabel together with it. This example sends the alias UID, alias label and payer IP address in options without a BLIK code. The bank authorizes the payment automatically.
The shop system initiates each charge according to the agreed schedule or service usage. Start subsequent charges only after confirming that the alias is registered.
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 maximum single recurring transaction is 2 000 PLN. Wait for an asynchronous transaction status notification before treating the payment as completed.
Example request
- Request
- Response (Success)
<?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 #2",
"amount" => [
"value" => 49.99,
"currencyCode" => "PLN"
],
"personalData" => [
"email" => "example@mail.com"
],
"returnUrl" => "https://cashbill.pl",
"description" => "Transaction description example",
"additionalData" => "#2",
"paymentChannel" => "blik_7517_RC",
"options" => [
["name" => "blikAliasUID", "value" => $blikAliasUID],
["name" => "blikAliasLabel", "value" => $blikAliasLabel],
["name" => "ip", "value" => "XXX.X.XXX.XX"]
]
];
$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"
}