Skip to main content
In this quickstart, you’ll set up a complete monetization flow: create a plan, embed checkout, and generate forward tokens for customer billing.
Building with an AI agent? See the Agents billing guide for how to set up customer billing programmatically.
Prerequisites: Complete the Track Usage Quickstart first.
1

Create a Plan

Go to Monetize > Plans and click New Plan. Configure:
  • Name: e.g. “Pro Plan” (customers see this)
  • Monthly Amount: e.g. $25.00
  • Rollover: Whether unused balance carries over
Copy the Plan ID (sc_xxxxx) — you’ll need it for checkout.
2

Create a Checkout Session (Backend)

Install the SDK and create a checkout session on your backend:
3

Embed Checkout (Frontend)

Use the useLavaCheckout hook to open the checkout modal. It handles phone verification, payment setup, and subscription creation in one flow.
4

Make Billed Requests

After checkout, use the customer ID to make requests that bill the customer:
Balance checks and usage billing will apply to your customer automatically.
5

Check the Dashboard

Go to Monetize > Customers to see your customer’s billing details, balance, and usage. Go to Analytics > Requests to see individual requests with cost breakdowns.

What’s Next?

Meters

Configure usage-based pricing rules for your meters

Checkout Guide

Advanced checkout: credit bundles, completion handling, and more

Webhooks

Receive notifications for customer and balance events

Forward Proxy

Token generation, multi-provider routing, and error handling

Troubleshooting

Verify @lavapayments/checkout is installed, the session token hasn’t expired (60-minute limit), and the component is in a client component ('use client').
Decode the token to inspect contents: echo "token" | base64 -d. Verify the secret key, customer ID, and meter slug are all valid and active in the dashboard.