Get started

Quickstart

Send your first reward to a verified Fomo identity: create a key, install the SDK, fund a vault, pay a handle, and get told when it's confirmed.

  1. Create an API key

    In the dashboard open API → Keys and create a key with the scopes you need (rewards:create and payments:read for this guide). The raw key is shown once; FomoPay only stores a hash. This deployment issues fp_live_… keys: they work against https://fomopay.family/v1 and move real USDG on Robinhood Chain mainnet.

    const me = await fp.me();
    // { project: { id: "proj_…", name: "FomoRun" }, key: { mode: "live", scopes: [...] }, chain: { key: "robinhood", id: 4663, … } }
  2. Install the SDK

    Terminal
    # the npm registry package is coming — until then, install the release tarball (it installs as @fomopay/sdk)
    npm install https://fomopay.family/sdk/fomopay-sdk-0.1.0.tgz

    Zero dependencies, ESM, typed. Runs on Node 18+, Bun, Deno and edge runtimes. Server-side only — the SDK refuses to run in a browser because API keys are secrets.

  3. Fund a Reward Vault

    Rewards are paid from a Reward Vault: a wallet you control (ideally a dedicated wallet or Safe) holding USDG, which approves FomoPay's payout signer for a capped allowance. Create one in Dashboard → Vaults; the funds never leave your wallet until a payout, and approve(signer, 0) revokes access any time.

  4. Pay a handle

    import { FomoPay } from "@fomopay/sdk";
    
    const fp = new FomoPay({ apiKey: process.env.FOMOPAY_API_KEY });
    
    const payment = await fp.rewards.create({
      recipient: "@their_handle", // the Fomo handle you're paying — every handle is a real account
      amount: "100",
      asset: "USDG",
      reason: "Quickstart reward",
      idempotencyKey: "reward_123",
    });
    
    console.log(payment.payment_id, payment.status); // pay_… CREATED
    201 Created (abridged)
    {
      "object": "payment",
      "payment_id": "pay_3c5e7g9j1m3p5r7t9v1x",
      "status": "CREATED",
      "type": "REWARD",
      "source": "vault",
      "recipient": { "handle": "@their_handle", "display_name": "Their Name", "sandbox": false },
      "amount": "100",
      "asset": "USDG",
      "network": "robinhood",
      "memo": null,
      "reason": "Quickstart reward",
      "idempotency_key": "reward_123",
      "idempotent_replayed": false,
      "tx_hash": null,
      "receipt_url": "https://fomopay.family/payment/pay_3c5e7g9j1m3p5r7t9v1x"
    }

    Run it twice: the second call returns the same payment with idempotent_replayed: true and HTTP 200 — nothing is paid twice. Change the amount but keep the key and you get 409 DUPLICATE_PAYMENT. See Idempotency.

  5. Know when it's paid

    wait.ts
    // Simple scripts: poll until the chain confirms and FomoPay verifies the transfer.
    const done = await fp.payments.wait(payment.payment_id, { timeoutMs: 120_000 });
    console.log(done.status, done.tx_hash); // CONFIRMED 0x…
    
    // Production: subscribe to payment.confirmed instead (next step).

    CONFIRMED means the transfer is on Robinhood Chain with enough confirmations and FomoPay verified it matches the payment (sender, recipient, amount, reference). Register a webhook to receive payment.confirmed:

    payment.confirmed
    {
      "id": "evt_7e9g1j3m5p7r9t1v3x5z",
      "type": "payment.confirmed",
      "created_at": "2026-10-12T18:04:19.000Z",
      "data": {
        "payment_id": "pay_3c5e7g9j1m3p5r7t9v1x",
        "status": "CONFIRMED",
        "type": "REWARD",
        "source": "vault",
        "recipient": "@their_handle",
        "recipient_profile_id": "fp_2b4d6f8h0k2m4p6r8t0v",
        "sandbox": false,
        "amount": "100",
        "asset": "USDG",
        "network": "robinhood",
        "chain_id": 4663,
        "tx": "0x8a1d4c7e0b3f6a9d2c5e8b1a4d7c0f3e6b9a2d5c8f1e4b7a0d3c6f9e2b5a8d1c",
        "explorer_url": "https://robinhoodchain.blockscout.com/tx/0x8a1d4c7e0b3f6a9d2c5e8b1a4d7c0f3e6b9a2d5c8f1e4b7a0d3c6f9e2b5a8d1c",
        "memo": null,
        "reason": "Quickstart reward",
        "metadata": {},
        "idempotency_key": "reward_123",
        "receipt_number": "FP-2026-000043",
        "receipt_url": "https://fomopay.family/payment/pay_3c5e7g9j1m3p5r7t9v1x",
        "error": null,
        "bulk_batch_id": null,
        "vault_id": "vault_3n5p7r9t1v3x5z7b9d1f"
      }
    }
    route.ts
    // app/api/fomopay/route.ts — Next.js route handler, Vercel Edge, Cloudflare Workers, Deno, Bun
    import { FomoPay } from "@fomopay/sdk";
    
    export async function POST(request: Request) {
      const raw = await request.text();
      try {
        const event = await FomoPay.webhooks.verify(raw, request.headers, process.env.FOMOPAY_WEBHOOK_SECRET!);
        await handle(event); // dedupe on event.id — deliveries are at-least-once
        return new Response("ok");
      } catch {
        return new Response("invalid signature", { status: 400 });
      }
    }

Optional: preview a recipient

You don't need to resolve before paying — FomoPay resolves server-side on every payment. Use resolve to show a recipient in your own UI (it never returns an address).

TypeScript
const r = await fp.resolve("@their_handle", { asset: "USDG" });
r.state; // "VERIFIED" → FomoPay Ready: payable on Robinhood Chain
r.profile; // { handle: "@their_handle", display_name: "Their Name", avatar_url: null, verified: true, sandbox: false, … }
r.payouts; // [{ network: "robinhood", asset_support: ["ETH", "USDG"], status: "verified" }]

Test safely on mainnet

There is no test network on this deployment. Keys are fp_live_…, the API is https://fomopay.family/v1 (the SDK's default), and every handle is a live Fomo account — so every payment is a real, irreversible transfer to a real person. Start small:

  • Cap the blast radius. Approve your first vault for a small allowance and set low per-payout and daily limits. The USDG contract enforces the allowance, so a bug can never spend more than you approved — and approve(signer, 0) revokes it.
  • Pay someone you know. Send a small amount to a handle you control (yours or a teammate's) and check the receipt before paying anyone else.
  • Check who it is. Resolve the handle and look at the display name and avatar before your code pays it — that's what catches a typo or a lookalike.
Terminal
export FOMOPAY_API_KEY=fp_live_…      # Dashboard → API → Keys — a secret, server-side only
export FOMOPAY_BASE_URL=https://fomopay.family/v1   # optional: the SDK defaults to https://fomopay.family/v1