Documentation/Stripe & Billing/Customer Provisioning

Customer Provisioning

Auto-create and manage Stripe customers and Checkout URLs in 1 line.


Customer Provisioning

`vibezcheck` makes it effortless to link your app users to Stripe customer accounts without setting up custom database tables.

1-Line Customer Matching

When you pass an email or user ID to `customer`, vibezcheck automatically looks up or provisions a Stripe customer record:

typescript
400 font-semibold">import { 400 font-semibold">vibezcheck } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'400 font-semibold">vibezcheck';
 
400 font-semibold">const vz = 400 font-semibold">vibezcheck();
 
// Provision or match Stripe customer
400 font-semibold">const customer = 400 font-semibold">await vz.customers.400 font-semibold">getOrCreate({
email: 400 font-semibold">class="text-emerald-400">'alex@company.com',
name: 400 font-semibold">class="text-emerald-400">'Alex Rivera',
});
 
console.log(customer.id); // 400 font-semibold">class="text-emerald-400">"cus_test_abc123"

Creating Checkout Sessions

Send users to a hosted Stripe Checkout page to add credits or subscribe to a metered plan:

typescript
400 font-semibold">const checkoutUrl = 400 font-semibold">await vz.billing.400 font-semibold">createCheckoutSession({
customerId: customer.id,
priceId: 400 font-semibold">class="text-emerald-400">'price_metered_tokens',
returnUrl: 400 font-semibold">class="text-emerald-400">'https://400 font-semibold">vibezcheck.app/dashboard',
});