Starting subsequent payment with a registered alias
Use the blikAliasUID assigned to the same user and send the required blikAliasLabel together with it. This example sends the alias UID, alias label and payer IP address in options. It does not send a BLIK code. The user still confirms the transaction in their banking application.
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 user
$blikAliasLabel = "cu...er@ex...om"; // Required account label shown in the banking application
$transaction = [
"title" => "Example BLIK One Click #2",
"amount" => [
"value" => 1.23,
"currencyCode" => "PLN"
],
"personalData" => [
"email" => "example@mail.com"
],
"returnUrl" => "https://cashbill.pl",
"description" => "Transaction description example",
"additionalData" => "#2",
"paymentChannel" => "blik_7517",
"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"
}