Step 1: Log in to the merchant portal and create a new LinkPay link.
More information about how to create a new LinkPay link can be found here.
Step 2: In the LinkPay settings, enable the fields you want to customize dynamically (e.g., amount, name, email) and mark them as "URL Changeable".
Step 3: Save the LinkPay configuration.
Step 4: Use the following PHP code to programmatically generate the payment URL with dynamic parameters:
<?php
$linkpay_prefix = 'https://payment.lhv.ee/lp'; // LinkPay URL
$api_secret = 'apisecret123456789'; //API SECRET FROM GENERAL SETTINGS
$params = [ //BELOW ADD ALL PARAMETERS WHICH YOU ENABLED UNDER LINKPAY LINK AND DATA
'transaction_amount' => '10',
'customer_name' => 'Your Customer Name',
'customer_email' => 'customer@email.com',
'order_reference' => 'YourOrderReference',
'linkpay_token' => '123abcd' //LINKPAY TOKEN FROM THE LINK
];
$query = http_build_query($params);
$query = str_replace("+","%20",$query);
$hmac = hash_hmac('sha256', $query, $api_secret);
$url = "{$linkpay_prefix}?{$query}&hmac={$hmac}";
echo $url;# outputs:
#
Step 5: Copy the generated URL.
Step 6: Send the link to your customer to complete the payment.
