getaddress - php

<?php
$data = new stdClass();
$reqj = new stdClass();
$url1 = "https://payment.hyperhashing.com/v1/getaddress";
$merchant_id = "";
$key = "";
$data->symbol = "usdt";
$data->usd_price = 120;
$data->type = "price";
$data->timestamp = time();
$reqj->merchant_id = $merchant_id;
$reqj->hash = base64_encode(hash_hmac('sha512', json_encode($data), $key, true));
$reqj->data = $data;
$res = http_post($url1, json_encode($reqj),true);
$address= json_decode($res, true);
echo $address['address'];
echo "<br><img src='https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=". $address['address']."'/>";
function http_post($url, $jsonStr)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: ' . strlen($jsonStr)
        )
    );
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return $response;
}
?>
###

Last updated