SDK catalog / Profit Ledger

Profit Ledger

alpha 0.1.0-alpha.5

Published release candidate for @wf/profit-ledger@0.1.0-alpha.5. Follow the registry guide and review compatibility before installing.

Join the alpha Sign in with Google, then add your name. We review alpha access requests.

import { createProfitLedger } from '@wf/profit-ledger';

// Run: node buyer.mjs /absolute/path/profit-ledger.yaml <allowed-location-id>
// This supplied-data example makes no GHL requests and needs no credentials.
const [configurationFile, locationId] = process.argv.slice(2);
if (!configurationFile || !locationId) throw new Error('Supply a YAML path and one location ID allowed by that file.');
const client = createProfitLedger(configurationFile);
try {
  const ledger = await client.calculate({
    locationId,
    transactions: [{ id: 'example-payment', locationId, date: '2026-09-09T12:00:00Z', customer: 'Example buyer', description: 'Example invoice', currency: 'USD', amountMinor: 10000, refundedMinor: 2000, status: 'succeeded' }],
    costs: [{ transactionId: 'example-payment', costMinor: 6000, feesMinor: 300 }],
  });
  process.stdout.write(JSON.stringify(ledger, null, 2) + '\n');
} finally { await client.close(); }