1. samm: Logi sisse Kaupmeheportaali ja loo uus LinkPay link
Rohkem infot uue LinkPay lingi loomise kohta leiad [siit].
2. samm: LinkPay seadetes luba väljad, mida soovid dünaamiliselt kohandada (nt summa, nimi, e-post) ja märgi need kui "URL Changeable"
3. samm: Salvesta LinkPay konfiguratsioon
4. samm: Kasuta järgmist PHP-koodi, et programmatiivselt genereerida makselink koos dünaamiliste parameetritega:
php
<?php
$linkpay_prefix = 'https://payment.sandbox.lhv.ee/lp/'; // Base LinkPay URL
$api_secret = 'apisecret123456789'; // API secret from portal settings
// Define the parameters to be included in the payment link
$params = [
'transaction_amount' => '10',
'customer_name' => 'Your Customer Name',
'customer_email' => 'customer@email.com',
'order_reference' => 'YourOrderReference',
'linkpay_token' => '123abcd' // Token from the LinkPay setup
];
// Convert parameters to a query string
$query = http_build_query($params);
// Replace "+" with "%20" for proper URL encoding
$query = str_replace("+", "%20", $query);
// Generate the HMAC signature
$hmac = hash_hmac('sha256', $query, $api_secret);
// Combine everything into a final URL
$url = "${linkpay_prefix}?${query}&hmac=${hmac}";
// Output the link
echo $url;
?>
5. samm: Kopeeri genereeritud URL
6. samm: Saada link oma kliendile, et ta saaks makse lõpule viia
