Charge customers based on what they use

1. Before each operation -> check access
2. After each operation  -> record usage
3. End of period         -> Accend invoices automatically
const access = await accend.access.check({
  customerId: "cus_123",
  meterId: "meter_123",
  quantity: 1
});

if (!access.data.allowed) {
  return { error: "upgrade_required", paymentUrl: access.data.paymentUrl };
}

await accend.usage.createEvent({
  customerId: "cus_123",
  meterId: "meter_123",
  quantity: 1,
  idempotencyKey: `req_${requestId}`
});
Always send an idempotencyKey when recording usage. Retries should not double-count.