How Bundles Relate to Subscription Configs
- Each subscription config (plan) can have zero or more credit bundles.
- A bundle belongs to exactly one subscription config.
- When you open checkout in
credit_bundlemode, you pass acredit_bundle_idand aconnection_id. The connection must already be on a subscription that includes that bundle (same subscription config).
credit_bundle checkout for these bundle IDs.
Finding Bundle IDs (Dashboard / Frontend)
Bundle IDs are not exposed on the public REST API—they are available in the Lava dashboard and via the tRPC API used by the frontend when you manage subscription configs.- In the dashboard: go to Monetize → Subscription configs. When you create or edit a plan, you add credit bundles and see their names and pricing. The frontend uses the config’s
creditBundles(includingcreditBundleId) from the subscription configs list/edit flows. - For the test checkout or any in-dashboard flow: the dashboard calls
merchantSubscription.listConfigs, which returns each config with itscreditBundlesarray. Each bundle hascreditBundleId,name,cost,creditAmount. UsecreditBundleIdwhen triggering acredit_bundlecheckout (e.g. test checkout or your own embedded flow that already has the config/bundle data from the dashboard).
When to Use credit_bundle Checkout Mode
Usecredit_bundle when:
- The customer already has a subscription (you have their
connection_id). - You want them to buy a fixed credit pack (one of the bundles attached to their plan).
- You want a single payment for that pack (no free-form amount).
- Customer is on a plan that has credit bundles.
- In your app, you show available packs (from the config’s
credit_bundles). - Customer picks a pack; you have the
credit_bundle_idfrom the config response. - Create a checkout session with
checkout_mode: 'credit_bundle',connection_id, andcredit_bundle_id. - Customer pays; credits are added to their current subscription cycle.
The connection must be on an active subscription for the same subscription config that owns the bundle. Otherwise checkout will fail.
Subscription Info and Credits
The connection subscription endpoint returns subscription details for a connection, including which plan they’re on and their remaining credits:subscription.name,subscription.period_amount,subscription.included_credit— plan details.subscription.credits.total_remaining,subscription.credits.cycle_remaining,subscription.credits.bundle_remaining— credit breakdown showing cycle credits vs purchased bundle credits.subscription.pending_change— when present, shows scheduled cancellation or downgrade at end of cycle.
subscription_config_id).