<?php
chdir(__DIR__);
require_once 'vendor/autoload.php';

$ucrmConfig = json_decode(file_get_contents('ucrm.json'), true);
$ucrmUrl = $ucrmConfig['ucrmLocalUrl'] ?? 'http://localhost';
$appKey = $ucrmConfig['pluginAppKey'];

$client = new \GuzzleHttp\Client([
    'base_uri' => rtrim($ucrmUrl, '/') . '/api/v1.0/',
    'verify' => false,
    'headers' => [
        'X-Auth-App-Key' => $appKey
    ]
]);

$paymentId = 818; // From screenshot

try {
    $response = $client->get("payments/$paymentId");
    echo $response->getBody();
} catch (\Exception $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}
