@customyai/billing
v0.1.2
Published
Customy Billing for apps: report usage of the meters an app declares, with its Access identity, over @customyai/core.
Maintainers
Readme
@customyai/billing
El consumo de una app en Customy Billing con su identidad de Customy Access. Sobre @customyai/core.
npm install @customyai/billing @customyai/coreimport { createBilling } from "@customyai/billing";
import type { CustomyMeter } from "./customy.generated"; // customy apps codegen
const billing = createBilling<CustomyMeter>({ platform, machineTokens });
await billing.usage.report([{ meter: "coach.runs", quantity: 1, idempotencyKey: `run-${runId}` }]);- Credencial:
machineTokenspide por defecto solobilling:usage:reportcon audienciacustomy-billing. La organización y la app salen del token. - Idempotencia: cada evento lleva su clave; el lote se puede repetir (y el SDK lo reintenta ante red o
5xx) sin sumar dos veces. - Errores:
CustomyBillingError(unCustomySdkErrorconservice: "billing"); los fallos de validación local salen comoSDK_USAGE_INVALIDsin llamar a la API.
