<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dokumentasi API RedPay v1.0</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Fira+Code:wght@400;500&display=swap');
        body { background-color: #f4f7f9; font-family: 'Inter', sans-serif; color: #334155; }
        .sidebar { height: 100vh; position: fixed; top: 0; left: 0; width: 280px; background: #0f172a; color: white; padding-top: 20px; z-index: 100; border-right: 1px solid #1e293b; }
        .sidebar a { color: #94a3b8; text-decoration: none; padding: 12px 25px; display: block; transition: all 0.2s; font-size: 0.95rem; }
        .sidebar a:hover, .sidebar a.active { color: white; background: #1e293b; border-left: 4px solid #ef4444; }
        .content { margin-left: 280px; padding: 50px; }
        .endpoint-badge { font-size: 0.75rem; font-weight: 800; padding: 4px 12px; border-radius: 6px; text-transform: uppercase; margin-right: 10px; }
        .badge-post { background: #10b981; color: white; }
        .card { border: none; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); border-radius: 12px; margin-bottom: 40px; overflow: hidden; }
        .card-header { background: white; border-bottom: 1px solid #e2e8f0; padding: 20px 25px; }
        pre { background: #1e293b; color: #e2e8f0; padding: 20px; border-radius: 8px; font-family: 'Fira Code', monospace; font-size: 0.85rem; position: relative; }
        .table-param thead { background: #f8fafc; color: #64748b; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
        .method-url { background: #f1f5f9; padding: 10px 15px; border-radius: 8px; font-family: 'Fira Code', monospace; font-size: 0.9rem; color: #0f172a; margin-bottom: 20px; border: 1px solid #e2e8f0; }
        code { color: #ef4444; font-weight: 600; }
        @media (max-width: 992px) { .sidebar { width: 100%; height: auto; position: relative; } .content { margin-left: 0; padding: 20px; } }
    </style>
</head>
<body>

<div class="sidebar d-none d-lg-block">
    <div class="px-4 mb-5">
        <h3 class="text-white fw-bold"><i class="fa-solid fa-bolt text-danger me-2"></i>RedPay API</h3>
        <span class="badge bg-danger">v1.0.0</span>
    </div>
    <nav>
        <a href="#intro" class="active"><i class="fa-solid fa-house me-2"></i> Pendahuluan</a>
        <a href="#generate"><i class="fa-solid fa-qrcode me-2"></i> Generate Payment</a>
        <a href="#status"><i class="fa-solid fa-magnifying-glass me-2"></i> Check Status</a>
        <a href="#withdraw"><i class="fa-solid fa-money-bill-transfer me-2"></i> Withdrawal</a>
        <a href="#callback"><i class="fa-solid fa-webhook me-2"></i> Callback Setup</a>
        <a href="#errors"><i class="fa-solid fa-circle-exclamation me-2"></i> Error Codes</a>
    </nav>
</div>

<div class="content">
    <section id="intro" class="mb-5">
        <h1 class="fw-bold mb-3">Dokumentasi API Integrasi</h1>
        <p class="lead text-muted">Gunakan API RedPay untuk memproses pembayaran QRIS, E-Wallet, dan Penarikan Dana secara otomatis ke sistem Anda.</p>
        <div class="method-url">
            <strong>BASE URL:</strong> https://redpay.zhero.web.id/bill/api
        </div>
    </section>

    <section id="generate">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0"><span class="endpoint-badge badge-post">POST</span> Generate Payment</h4>
            </div>
            <div class="card-body p-4">
                <p>Endpoint ini digunakan untuk membuat instruksi pembayaran IDR (QRIS atau DANA).</p>
                <div class="method-url">/generate</div>
                
                <h6 class="fw-bold mb-3">Request Parameters</h6>
                <div class="table-responsive">
                    <table class="table table-hover table-param">
                        <thead><tr><th>Parameter</th><th>Type</th><th>Req</th><th>Description</th></tr></thead>
                        <tbody>
                            <tr><td><code>username</code></td><td>String</td><td>Yes</td><td>ID Agen yang terdaftar.</td></tr>
                            <tr><td><code>key</code></td><td>String</td><td>Yes</td><td>API Key rahasia Anda.</td></tr>
                            <tr><td><code>amount</code></td><td>Integer</td><td>Yes</td><td>Nominal (Tanpa titik/koma).</td></tr>
                            <tr><td><code>player_username</code></td><td>String</td><td>Yes</td><td>ID pemain di sistem Anda.</td></tr>
                            <tr><td><code>channel</code></td><td>String</td><td>No</td><td><code>QRIS</code> (default) atau <code>DANA</code>.</td></tr>
                        </tbody>
                    </table>
                </div>

                <div class="row mt-4">
                    <div class="col-xl-7">
                        <h6 class="fw-bold">Response Sukses (QRIS)</h6>
                        <pre>{
  "success": true,
  "data": {
    "type": "QRIS",
    "currency": "IDR",
    "username": "player_01",
    "transaction_id": "QR-ABC12345",
    "amount": "10000",
    "expired_at": "2025-12-25 21:30:00",
    "qris_image": "https://redpay.zhero.web.id/qris/QR-ABC12345.png",
    "qris_data": "00020101021226670016COM.NOBUBANK.WWW..."
  }
}</pre>
                    </div>
                    <div class="col-xl-5">
                        <h6 class="fw-bold">Response Sukses (DANA)</h6>
                        <pre>{
  "success": true,
  "data": {
    "type": "DANA",
    "transaction_id": "DN-XYZ98765",
    "amount": "50000",
    "payment_url": "https://m.dana.id/n/link/..."
  }
}</pre>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section id="status">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0"><span class="endpoint-badge badge-post">POST</span> Check Status</h4>
            </div>
            <div class="card-body p-4">
                <p>Cek status transaksi secara manual menggunakan <code>transaction_id</code> kustom (QR-/DN-).</p>
                <div class="method-url">/status</div>
                
                <h6 class="fw-bold">Response Sukses</h6>
                <pre>{
  "success": true,
  "data": {
    "type": "QRIS",
    "username": "player_01",
    "transaction_id": "QR-ABC12345",
    "amount": "10000",
    "remark": "Payment successful",
    "status": "success"
  }
}</pre>
            </div>
        </div>
    </section>

    <section id="withdraw">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0"><span class="endpoint-badge badge-post">POST</span> Withdrawal (Payout)</h4>
            </div>
            <div class="card-body p-4">
                <p>Mengirimkan dana dari saldo RedPay Anda ke rekening Bank tujuan.</p>
                <div class="method-url">/payout</div>
                
                <h6 class="fw-bold mb-3">Specific Parameters</h6>
                <div class="table-responsive">
                    <table class="table table-hover table-param">
                        <thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead>
                        <tbody>
                            <tr><td><code>bank_target</code></td><td>String</td><td>Contoh: BCA, BNI, BRI, MANDIRI.</td></tr>
                            <tr><td><code>account_number</code></td><td>String</td><td>Nomor rekening tujuan.</td></tr>
                            <tr><td><code>account_name</code></td><td>String</td><td>Nama pemilik rekening.</td></tr>
                        </tbody>
                    </table>
                </div>

                <h6 class="fw-bold mt-4">Response Sukses</h6>
                <pre>{
  "success": true,
  "data": {
    "type": "WITHDRAW",
    "transaction_id": "WD1766624581",
    "amount": "100000",
    "bank_target": "BCA",
    "account_number": "887099231",
    "account_name": "BUDI SUDARSONO",
    "status": "success"
  }
}</pre>
            </div>
        </div>
    </section>

    <section id="errors">
        <h3 class="fw-bold mb-4">Error Handling</h3>
        <div class="card bg-dark text-white">
            <div class="card-body">
                <table class="table table-dark table-hover mb-0">
                    <thead><tr><th>HTTP Code</th><th>Message</th><th>Reason</th></tr></thead>
                    <tbody>
                        <tr><td>400</td><td><code>Authentication required</code></td><td>Username atau Key kosong dalam request.</td></tr>
                        <tr><td>400</td><td><code>Invalid credentials</code></td><td>Username atau API Key tidak ditemukan/tidak aktif.</td></tr>
                        <tr><td>400</td><td><code>Missing required fields</code></td><td>Parameter seperti amount atau player_username tidak ada.</td></tr>
                        <tr><td>400</td><td><code>IP Network Unauthorized</code></td><td>IP server Anda belum didaftarkan di whitelist GSPay.</td></tr>
                        <tr><td>400</td><td><code>Transaction not found</code></td><td>ID Transaksi tidak ditemukan di database.</td></tr>
                    </tbody>
                </table>
            </div>
        </div>
    </section>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>