<?php
require 'vendor/autoload.php';
use Midtrans\Config;
use Midtrans\Snap;

Config::$serverKey = 'Mid-server-Hd-PIUQkKfZG1HfDdW6KMhVa';
Config::$isProduction = true;

$params = [
    'transaction_details' => [
        'order_id' => 'TEST-' . time(),
        'gross_amount' => 10000,
    ]
];

echo "Mencoba koneksi ke Midtrans...\n";
try {
    $token = Snap::getSnapToken($params);
    echo "BERHASIL! Token: " . $token . "\n";
} catch (Exception $e) {
    echo "GAGAL! Error: " . $e->getMessage() . "\n";
}
