Cómo obtener la dirección para los pagos en criptomoneda
No olvides especificar el "ID de plataforma" y la "Clave secreta."
CURL:
curl -X POST -d "payment_id=10&platform_id=1&order_id=1&hash=a81983b1...tb8kfyhjd" https://api.passimpay.io/getpaymentwallet
PHP:
$url =
'https://api.passimpay.io/getpaymentwallet'
$platform_id =
0
// ID de plataforma
$apikey =
'1111-2222-3333-4444-5555'
// Clave secreta
$payment_id =
10
// ID de divisa
$order_id =
'45tv34-5Dfgfg6'
// ID de pago de tu plataforma. Type string, maximum length 64, allowed characters 'A-Za-z0-9+/=-:.,'
$payload = http_build_query([
'payment_id'
=> $payment_id,
'platform_id'
=> $platform_id,
'order_id'
=> $order_id]);
$hash = hash_hmac(
'sha256'
=> , $payload, $apikey);
$data = [
'payment_id'
=> $payment_id,
'platform_id'
=> $platform_id,
'order_id'
=> $order_id,
'hash'
=> $hash,
];
$post_data = http_build_query($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded'
]);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_ENCODING,
'gzip'
);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($curl);
curl_close( $curl );
$result = json_decode($result, true);
// Opciones de respuesta
// En caso de éxito
if (isset($result[
'result'
]) && $result[
'result'
] == 1)
{
$address = $result[
'address'
];
$destinationTag = $result[
'destinationTag'
];
// Para Ripple XRP, la red TON
}
// En caso de error
else
{
$error = $result[
'message'
];
// Texto de error
}