Documentation/Stripe & Billing/Customer Provisioning
Customer Provisioning
Auto-create and manage Stripe customers in 1 line of code.
Customer Provisioning
`vibezcheck` eliminates the need to manually query Stripe or sync customer records to a database.
---
`vz.customers.getOrCreate()`
Automatically retrieves existing Stripe customers by email or provisions a new `cus_test_...` record with in-memory caching:
typescript
import { vibezcheck } from 'vibezcheck';
const vz = vibezcheck();
// 1. Auto-Provision Customer
const customer = await vz.customers.getOrCreate({
email: 'alex@company.com',
name: 'Alex Rivera',
});
console.log(customer.id); // "cus_R3K7h9Qv..."
// 2. Generate Stripe Checkout Session URL
const checkoutUrl = await vz.billing.createCheckoutSession({
customerId: customer.id,
priceId: 'price_metered_tokens',
returnUrl: 'https://myapp.com/dashboard',
});