live · mainnetme · ochk · io
federation-custodied · self-custody-ready
§ integrate · quickstart

Six steps. About five minutes.

From npm install to first billable envelope, with the actual code samples each step uses. Mark steps done as you go; no progress is persisted, no account needed to read this page.

§ progress
0 / 6 · 0%
  1. [01]

    install the SDK

    two npm packages — me-client (the consumer SDK) and auth-client (the React provider, re-exported by me-client for convenience).

    yarn add @orangecheck/me-client @orangecheck/auth-client
  2. [02]

    mount the provider

    wrap your app once at the root. defaults pin authOrigin to https://ochk.io — you only override in dev. every component below it can call useOcSession() to read the live cross-subdomain session.

    // _app.tsx
    import { OcSessionProvider } from '@orangecheck/me-client';
    
    export default function App({ Component, pageProps }) {
      return (
        <OcSessionProvider>
          <Component {...pageProps} />
        </OcSessionProvider>
      );
    }
  3. [03]

    drop the sign-in button

    next to your existing google/apple/magic-link options — OC is an OAuth peer. first-time users get a federation-custodied wallet provisioned silently. no seed phrase, no key handling, no "what is a sat" conversation.

    import { OcSignInButton } from '@orangecheck/me-client';
    
    export function SignInOptions() {
      return (
        <>
          {/* your existing buttons */}
          <OcSignInButton scope={['identity']}>
            sign in with oc · earn sats
          </OcSignInButton>
        </>
      );
    }
  4. [04]

    configure your prices

    declare per-event prices and user-share splits. you choose what subtypes to bill, the price per event, and how much flows back to the user. OC takes a fixed 20% platform fee — the rest is yours and your users'.

    import { oc } from '@orangecheck/me-client';
    
    await oc.config.update({
      project_key: 'pk_live_yourcompany',
      display_name: 'YourCompany',
      domain: 'yourcompany.example',
      events: {
        session_creation: {
          enabled: true,
          site_pays: { kind: 'fixed_sats', sats: 60 },
          user_share_pct: 0.65,
        },
        payment_authorization: {
          enabled: true,
          site_pays: { kind: 'percent_of_amount', pct: 0.0075 },
          user_share_pct: 0.65,
        },
      },
    });
    open the live configurator
  5. [05]

    verify a webhook

    OC delivers every billable envelope to your registered endpoint, signed with the federation Ed25519 key. always verify against the raw body — frameworks that re-serialize before your handler will produce a different byte sequence and the signature will not validate.

    // node · express raw-body verification
    import { oc } from '@orangecheck/me-client';
    
    app.use(express.text({ type: 'application/json' }));
    
    app.post('/api/oc/webhook', async (req, res) => {
      const result = await oc.webhook.verify(
        req.body,
        req.header('OC-Signature'),
        req.header('OC-Key-Id'),
      );
      if (!result.ok) return res.status(401).end(result.reason);
    
      const envelope = JSON.parse(req.body);
      await onOcEvent(envelope);
      res.status(200).end();
    });
    reception code · node + rust
  6. [06]

    ship it

    request your project_key at /contact?topic=integration, mount the SDK, watch envelopes land on /developer/events. paired comparisons against your actual stack come back in a business day.

    # /contact?topic=integration
    
    stack: auth0 starter + stripe + twilio
    mau: 18,400
    payments_per_user_per_month: 4
    average_payment_usd: 14
    request a paired comparison

next, deeper

The quickstart gets you to first envelope. After that: /integrate has the full configurator, /integrate/sandbox runs your config against a representative one-month event mix, /sdk documents every export, and /developer is the dashboard where every envelope your project signs lands.