Қолтаңбаны қалыптастыру
curl --location 'https://prapi.tarlanpayments.kz/transaction/...' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ff1a38a78ccca1b313ae172307e49112066ec2f5a1dfa2a76110104da3012896'
--data-raw '{}'<?php
$requestData = [
"project_client_id" => "9999",
"merchant_id" => 1,
"project_id" => 1,
"additional_data" => ["key" => "This should be excluded"]
];
$secret = "12345";
// Remove the "additional_data" field from the request data
unset($requestData["additional_data"]);
// Sort the request data by keys in alphabetical order
ksort($requestData);
// Encode the sorted request data to JSON
$sortedJson = json_encode($requestData, JSON_UNESCAPED_SLASHES);
// Encode the sorted JSON to base64
$base64EncodedData = base64_encode($sortedJson);
// Concatenate the base64-encoded data with the secret
$dataToSign = $base64EncodedData . $secret;
// Hash the result to SHA-256
$sha256Hash = hash("sha256", $dataToSign);
echo $sha256Hash;Last updated
Was this helpful?