Skip to main content

Problem

You want to show customers their remaining credits, subscription plan, and prompt them to add funds when their balance is low.

Solution

Use customers.getSubscription() to fetch the full credit breakdown, then render it in your UI.

API Route

Pre-Request Check

Gate AI requests on credit availability:

Next Steps

Checkout

Embed a checkout flow for subscriptions and credit bundles

Plans & Subscriptions

Configure included credits and rollovers