'usdt', 'amount' => '10.50', 'jurisdiction' => 'BR', 'expires_at' => '2026-12-31T23:59:59+00:00', 'reference' => 'order-12345', ], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES, ); $url = 'https://api.yoobank.net/api/v1/merchants/' . rawurlencode($merchantUuid) . '/pay-in-intents'; $handle = curl_init($url); if ($handle === false) { fwrite(STDERR, "Unable to start HTTP client.\n"); exit(1); } curl_setopt_array($handle, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $token, 'Content-Type: application/json', 'Idempotency-Key: ' . $idempotencyKey, 'Accept: application/json', ], CURLOPT_POSTFIELDS => $payload, CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 30, ]); $body = curl_exec($handle); $errno = curl_errno($handle); $status = (int) curl_getinfo($handle, CURLINFO_HTTP_CODE); curl_close($handle); if ($errno !== 0 || !is_string($body)) { fwrite(STDERR, "HTTP request failed.\n"); exit(1); } if ($status !== 201) { fwrite(STDERR, 'Create PAY-IN failed HTTP ' . $status . ': ' . $body . PHP_EOL); exit(1); } $decoded = json_decode($body, true); if (!is_array($decoded) || !isset($decoded['intent_uuid'], $decoded['address'], $decoded['expected_amount'])) { fwrite(STDERR, "Unexpected create response.\n"); exit(1); } echo $decoded['intent_uuid'] . PHP_EOL; echo $decoded['expected_amount'] . PHP_EOL; echo $decoded['address'] . PHP_EOL;