NielsNumbers's avatar

Cashier: Subscription with metered and fixed price?

Hey everyone,

I currently have Stripe set up with two separate subscriptions:

Subscription A: a fixed-price monthly plan

Subscription B: a metered (usage-based) monthly plan

When a user registers, they can choose to sign up for both. Right now, I create them like this:

$user->newSubscription('sub_a', $priceA)
    ->create('pm_card_visa');

$user->newSubscription('sub_b')
    ->meteredPrice($recoverPrice)
    ->quantity(null)
    ->create('pm_card_visa');

This works fine - both renew monthly on the same day - but Stripe generates two separate invoices.

What I’d like to achieve is a single subscription that includes both a fixed and a metered price, so the user gets one combined invoice / single charge per month.

From Stripe’s docs, I know subscriptions can have multiple items, but it’s not clear how to mix fixed and metered prices (especially when using Laravel Cashier).

Has anyone successfully combined these two billing types into one subscription or found a clean way to do it with Cashier?

Thanks!

0 likes
6 replies
LaryAI's avatar
Level 58

To achieve a single combined subscription with both a fixed-price and a metered (usage-based) price in Stripe using Laravel Cashier, you need to use subscription items. Stripe supports multiple prices per subscription, and each price can have its own billing scheme (recurring or metered).

Here’s how you can set it up in Laravel Cashier:

1. Create the subscription with multiple items

You can use the addPrice and meteredPrice methods when creating a subscription:

use Laravel\Cashier\Cashier;

// Assume $fixedPriceId and $meteredPriceId are the Stripe price IDs
$user->newSubscription('default', $fixedPriceId)
    ->addPrice($meteredPriceId, [
        'quantity' => null, // For metered, Stripe expects null here
        'metered' => true,  // Indicate that this price is metered
    ])
    ->create('pm_card_visa');

2. Report usage for the metered item

For the metered item, you need to report usage to Stripe throughout the billing period:

$user->subscription('default')
    ->reportUsage($meteredPriceId, $quantity, $timestamp);
  • $quantity: Number of units used.
  • $timestamp: Unix timestamp of the usage event.

3. Result

This will create a single Stripe subscription with:

  • A fixed monthly price (recurring item).
  • A usage-based price (metered item).

At the end of each billing period, Stripe will generate one invoice that combines both items.


Example with Cashier's addPrice and metered usage

$user->newSubscription('default', $fixedPriceId)
    ->addPrice($meteredPriceId)
    ->create('pm_card_visa');

When you add a metered price, Stripe itself knows (based on the price setup in the dashboard) whether it is metered or fixed, so you don't need to specify 'metered' here—just ensure your Stripe price is properly configured as metered.

Then, just report usage as shown above during the billing period.


Notes:

  • Make sure both prices (recurring and metered) are set up in Stripe, with the proper billing scheme.
  • Laravel Cashier (as of v13+) supports multiple prices per subscription.
  • Check official Cashier docs for any version-specific details.

Summary:
Yes, you can create a single subscription with both fixed and metered pricing using multiple prices on the subscription. Use addPrice() with your recurring and metered prices, and report usage for metered items as needed. Stripe will generate a unified invoice per billing period.

NielsNumbers's avatar

This does not work, addPrice can only be called on a Subscription object, not on SubscriptionBuilder, and you can't pass an array as 2nd paramter to addPrice

vincent15000's avatar
Level 63

I think that it just comes from the subscription name.

$user->newSubscription('sub_a', $priceA)

You have sub_a and sub_b, you should set sub_a for both ... or default for both.

Use different names if you handle different subscriptions for different structures / enterprises, for example you handle subscriptions company A and company B (the companies are not clients, but have their own clients, which clients subscribe to their own plans).

company A :

  • fixed amount

  • metered amount

company B :

  • fixed amount

  • metered amount

If you are just handling your own subscriptions, default is sufficient and the invoices will group all types of subscriptions for one client.

1 like
NielsNumbers's avatar

Hey vincent, thanks for the respond, you are right, it makes no sense that I created two subscriptions, as I wanted to have only one subscription. If I call newSubscription twice with same subscription name, I end up with two subscriptions at stripe.

This is how it worked:

$user->newSubscription('default', $priceTagFixed)
                    ->trialDays(14)
                    ->create(
                        'pm_card_visa', 
                        [
                            'test_clock' => $clock->id,
                        ]
                    )
                    ->addMeteredPrice($priceTagMetered);
1 like
vincent15000's avatar

Happy to help ;).

If you have solved your issue, don't forget to close the post.

NielsNumbers's avatar

You mean mark as best reply? Or can you actually close a question?

1 like

Please or to participate in this conversation.