Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

albertooo's avatar

Laravel Cashier metadata drives me crazy !

Hello dear community,

I am implementing laravel cashier on laravel 8 with laravel cashier 12.50 and php 7.4.12

i follow everything but really can't pass metadata i tried everything spend more than 24 hours to find a solution to pass metadate. According to the doc it says i have to use withMetadata(), below my syntax but no metadata are passed with mycontoller to stripe :

$request->user()->newSubscription('default', $plan->stripe_id)
->withMetadata(['key' => 'value'])
->create($request->token);

Any help so much appreciated !

0 likes
6 replies
albertooo's avatar

Thanks dear Braunson,

Just make a shot with :

$request->user()->newSubscription('default', $plan->stripe_id)->create($request->stripeToken, [
                'email' => '[email protected]',
            ], [
                'metadata' => ['note' => 'Some extra information.'],
            ]);

And as usual... doesn't work really lost... if you have any idea ;)

Thanks !

DayDev's avatar

Is there a way to pass metadata to the swap method?

DayDev's avatar

Nevermind, I just realized the docs say that when swapping plans, metedata is preserved from the old plan to the new plan. Not sure how to update the metadata though.

larafever's avatar

Just pass a second parameter to the swap method like this

swap('price_monthly', [ "metadata"=> []])

scotty2hotty's avatar

did anyone find a solid way to attach metadata directly to a Stripe subscription using Cashier without jumping through too many hoops? I'm running into the same issue now and wondering if anyone’s found a better workaround since this thread was last active.

Please or to participate in this conversation.