BLIK WEB Redirect
BLIK Redirect uses the standard transaction implementation. To direct the customer to the BLIK payment page, set paymentChannel to blik when creating the transaction, then redirect the customer's browser to the redirectUrl returned by the API.
Customer enters their BLIK code on the BLIK payment page. You do not need to collect or send a blikCode in your application.
Example request
- PHP
<?php
$shopId = ""; // Payment Point ID
$secretPhrase = ""; // Payment Point Secret
$mainUrl = "https://pay.cashbill.pl/ws/rest";
$transactionRequest = array(
"title" => "Example BLIK Redirect #1",
"amount" => array(
"value" => 1.23,
"currencyCode" => "PLN",
),
"returnUrl" => "https://cashbill.pl",
"description" => "Transaction description example",
"additionalData" => "#1",
"paymentChannel" => "blik",
);
$transactionRequest['sign'] = sha1(
$transactionRequest['title']
. $transactionRequest['amount']['value']
. $transactionRequest['amount']['currencyCode']
. $transactionRequest['returnUrl']
. $transactionRequest['description']
. $transactionRequest['additionalData']
. $transactionRequest['paymentChannel']
. $secretPhrase
);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_URL => "{$mainUrl}/payment/{$shopId}",
CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
CURLOPT_POSTFIELDS => json_encode($transactionRequest),
));
$ret = curl_exec($ch);
$response = json_decode($ret);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != "200") {
echo "Error message: {$response->errorMessage}";
} else {
echo "Order ID [{$response->id}] and redirect URL [{$response->redirectUrl}]";
}
Schema of the response
{
"id": "string",
"redirectUrl": "string"
}
Use id to identify the transaction and redirectUrl to redirect the customer to the BLIK payment page. Process transaction status updates using the standard notification service.