Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

5.3 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>hood-pay demo shop</title>
  <style>
    :root { color-scheme: dark; }
    body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      background: #0b0e12; color: #e8edf4; line-height: 1.55; }
    .wrap { max-width: 900px; margin: 0 auto; padding: 48px 24px; }
    .grid { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: start; }
    h1 { font-size: 1.9rem; letter-spacing: -0.03em; margin: 0 0 6px; }
    .grad { background: linear-gradient(90deg, #00c805, #00e5a0); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .muted { color: #8b96a5; }
    .product { background: #12161d; border: 1px solid #232a35; border-radius: 16px; padding: 26px; }
    .price { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 14px 0; }
    .price small { font-size: 1rem; color: #8b96a5; font-weight: 600; margin-left: 6px; }
    button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: 13px 18px;
      color: #04110a; background: linear-gradient(90deg, #00c805, #00e5a0); }
    button:hover { filter: brightness(1.08); }
    button[disabled] { opacity: 0.55; cursor: not-allowed; }
    .status { margin-top: 18px; font-size: 14px; color: #8b96a5; font-variant-numeric: tabular-nums; }
    .good { margin-top: 18px; background: #0f1720; border: 1px solid rgba(0,229,160,0.35); border-radius: 12px; padding: 18px; }
    .good h3 { margin: 0 0 8px; color: #00e5a0; font-size: 15px; }
    .good p { margin: 0; font-size: 14px; }
    a { color: #00e5a0; }
    code { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; color: #a5d6ff; }
    .badge { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
      padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,180,84,0.4); color: #ffb454; }
    @media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
  </style>
</head>
<body>
  <div class="wrap">
    <h1><span class="grad">hood-pay</span> demo shop</h1>
    <p class="muted">One digital good, sold for USDG, verified on-chain. No payment processor.</p>
    <div class="grid" style="margin-top:28px;">
      <div class="product">
        <span class="badge" id="net">…</span>
        <h2 id="title" style="margin:12px 0 4px;">…</h2>
        <p class="muted" id="blurb"></p>
        <div class="price"><span id="price">…</span><small id="sym">USDG</small></div>
        <button id="buy">Buy now</button>
        <div class="status" id="status"></div>
        <div class="good" id="good" style="display:none;">
          <h3>✓ Payment verified - your download</h3>
          <p id="good-body"></p>
        </div>
      </div>
      <div>
        <div class="product">
          <h3 style="margin:0 0 4px;font-size:15px;">Checkout</h3>
          <p class="muted" style="font-size:13px;margin:0 0 16px;">Connect an EIP-6963 wallet, switch to Robinhood Chain, and pay. The exact amount carries a unique fingerprint so the shop can match your payment.</p>
          <div id="checkout"></div>
        </div>
      </div>
    </div>
  </div>

  <script src="/hood-pay.min.js"></script>
  <script>
    var product, invoice, poll;
    var $ = function (id) { return document.getElementById(id); };

    fetch('/api/product').then(function (r) { return r.json(); }).then(function (p) {
      product = p;
      $('title').textContent = p.title;
      $('blurb').textContent = p.blurb;
      $('price').textContent = p.price;
      $('sym').textContent = p.token.symbol;
      $('net').textContent = p.network + ' · ' + p.chainId;
    });

    function pollStatus(id) {
      clearInterval(poll);
      poll = setInterval(function () {
        fetch('/api/checkout/' + id).then(function (r) { return r.json(); }).then(function (s) {
          $('status').textContent = 'invoice ' + s.invoiceId.slice(0, 10) + '… · status: ' + s.status;
          if (s.good) {
            clearInterval(poll);
            $('good').style.display = 'block';
            $('good-body').textContent = s.good;
            $('buy').disabled = false;
            $('buy').textContent = 'Buy another';
          }
        });
      }, 2500);
    }

    $('buy').addEventListener('click', function () {
      $('buy').disabled = true;
      $('good').style.display = 'none';
      $('status').textContent = 'reserving an invoice…';
      fetch('/api/checkout', { method: 'POST' }).then(function (r) { return r.json(); }).then(function (inv) {
        if (inv.error) { $('status').textContent = 'error: ' + inv.error; $('buy').disabled = false; return; }
        invoice = inv;
        $('status').textContent = 'pay exactly ' + inv.amount + ' ' + inv.token.symbol + ' (fingerprinted)';
        window.HoodPay.mount('#checkout', {
          payTo: inv.payTo,
          amount: inv.amount,
          network: inv.network,
          token: inv.token,
          memo: inv.memo,
          onSuccess: function (receipt) {
            $('status').textContent = 'payment sent (' + receipt.txHash.slice(0, 12) + '…) - verifying on-chain…';
          }
        });
        pollStatus(inv.invoiceId);
      });
    });
  </script>
</body>
</html>