Get started · Quickstart

Quickstart

Spin up a merchant vault, authorize a terminal, and accept your first stablecoin payment in under five minutes.

1. Install the SDK

Pick your stack. The SDK ships with TypeScript types and identical APIs across languages.

# npm
$ npm install @opk/sdk

# or yarn
$ yarn add @opk/sdk

# or pip
$ pip install opk-sdk

2. Deploy a merchant vault

Every merchant gets a ClearingVault — the contract that holds funds, applies hooks, and routes the AUD off-ramp. Deploy once.

import { OPK } from "@opk/sdk";

const opk = new OPK({ network: "base-mainnet" });

const vault = await opk.vaults.create({
  token:  "AUDD",
  payout: "bsb:062-000:acct:12345678",
});

console.log(vault.address); // 0x449B…Ae65
Note — The vault address is deterministic. Re-deploying with the same parameters returns the same address; idempotent by design.

3. Authorize a terminal

Add an operator key. This is what the terminal uses to issue invoices on behalf of the vault. Operator keys can be rotated anytime; payout addresses cannot (30-day timelock).

await vault.authorizeTerminal({
  terminalId: "0xTERM0001",
  publicKey:  "0x04…",
});

4. Accept a payment

Issue an invoice. Display the QR. Wait for settlement.

const invoice = await vault.createInvoice({
  amount: "12.50",
  token:  "AUDD",
  metadata: { order: "#2451" },
});

// display invoice.qrCode to the customer

await invoice.waitForSettlement();
console.log(invoice.tx); // 0x8f2…d301

Next steps

  • Attach a hook → write a ChloesLoyalty.sol
  • Set up daily AUD off-ramp → connect your bank
  • Listen for events with the WebSocket subscription
  • Read the protocol whitepaper