Usage Metering

Record usage, then try again with the same key — Lumn catches the duplicate and prevents double-billing.

import Lumn from '@lumnsh/stripe';
const lumn = new Lumn(process.env.NEXT_PUBLIC_LUMN_API_KEY);
const customer = await lumn.customers.create({
external_id: 'user_' + Date.now(),
email: 'demo@example.com',
name: 'Demo User',
});

Step 1 - Create customer (customers.create)

Parameter reference
ParameterTypeRequiredDescriptionExample
external_idstringRequiredYour app's user id (stable, unique).`user_${Date.now()}`
emailstringRequiredCustomer email.demo@example.com
namestringRequiredCustomer display name.Demo User

Interactive UI & Output

Paste your API key above to try

Customize parameters

Provide an existing customer to skip creation. Customize event_name and value for the metering calls.