Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
<?php
declare(strict_types=1);
$merchantId = getenv('COINSSEND_MERCHANT_ID');$apiKey = getenv('COINSSEND_API_KEY');
$payload = [ 'network' => 'tron', 'coin' => 'usdt', 'type' => 'static', 'label' => 'Checkout deposits', 'webhook_url' => 'https://merchant.example/coinssend/webhook',];
$body = json_encode($payload, JSON_THROW_ON_ERROR);$sign = md5(base64_encode($body).$apiKey);
$handle = curl_init('https://api.coinssend.com/v1/wallet-address');curl_setopt_array($handle, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Merchant: '.$merchantId, 'Sign: '.$sign, ],]);
$rawResponse = curl_exec($handle);if ($rawResponse === false) { throw new RuntimeException(curl_error($handle));}
$httpStatus = curl_getinfo($handle, CURLINFO_HTTP_CODE);curl_close($handle);$response = json_decode($rawResponse, true, flags: JSON_THROW_ON_ERROR);
if ($httpStatus < 200 || $httpStatus >= 300) { throw new RuntimeException($response['error'] ?? $response['message'] ?? "HTTP {$httpStatus}");}
printf("Address: %s\nQR: %s\n", $response['data']['address'], $response['data']['qr_code_url']);Static-wallet creation has no request idempotency contract. A timeout does not prove that creation failed, so do not automatically repeat this POST. Fetch the live catalog instead of treating the example asset pair as permanent.