Getting started

Getting started

OpenCard gives AI agents programmable payment primitives in a simulation-first environment. You can model spend controls, approvals, card issuance, and event timelines before wiring to real payment rails.

This guide covers the fastest path from install to your first end-to-end procurement flow. For teams, we recommend committing a shared policy config and a standard event schema before moving to production.

Install

npm install @opencard/sdk @opencard/mock-provider
import { OpenCardSDK } from "@opencard/sdk";import { MockPaymentProvider } from "@opencard/mock-provider";
const sdk = new OpenCardSDK({  paymentProvider: new MockPaymentProvider({ latencyMs: 150 }),  policy: {    autoApproveLimit: 100,    maxPerTransaction: 1000,    allowedCategories: ["office-supplies", "cloud-services"]  }});

What you can build

  • Agent-to-merchant payment flows
  • Spend policy enforcement with clear block reasons
  • Human-in-the-loop approval flows
  • Event timelines for observability, reporting, and post-incident analysis
  • Multi-agent cost splitting and internal settlements

Recommended flow

  1. Install SDK and mock provider
  2. Create an agent wallet and fund it
  3. Issue a virtual card with constraints
  4. Request spend and process approval
  5. Execute merchant payment and inspect events

Production readiness checklist

  • Define policy ownership (security, finance, and platform engineering)
  • Enable idempotency keys for retried spend requests
  • Capture event IDs and correlation IDs in your observability pipeline
  • Set category-level controls before granting broad card scopes