PHP Snippet 1:
function curl_coin_payment ($postdata = array()) {
$url = "https://www.coinpayments.net/api.php";
$payload = $postdata;
$payload['key'] = 'public_key';
$payload['version'] = 1;
$payload = http_build_query($payload, '', '&');
$api_secret = 'private_key';
$apiseal = hash_hmac('sha512', ($payload), $api_secret);
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($payload)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
"HMAC: $apiseal",
"Content-Type: application/x-www-form-urlencoded",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $request = curl_exec ($ch); curl_close ($ch);
return $request;
}