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

Mick79's avatar

Pass metadata with Laravel cashier

Hi,

I am enjoying Laravel Cashier. I have implemented Stripe many times with the standard PHP sdk and Cashier is a big time saver. However I can't see anywhere how to pass metadata.

I can only imagine this must be possible as it's one of the most useful features of Stripe's system.

I am calling like this

$user->newSubscription('main', 'sbus')->create($token);

I have seen various threads via google that suggest modifying the Cashier core, but I don't believe that can be the correct way to handle this.

Any help?

0 likes
3 replies
martinbean's avatar
Level 80

@mick79 You can use the handily-named withMetadata() method:

$user->newSubscription('main', 'sbus')
     ->withMetadata($array)
     ->create($token);

You can also pass a coupon in a similar way:

$user->newSubscription('main', 'sbus')
     ->withCoupon($coupon)
     ->create($token);

You’re right in that you definitely shouldn’t be modifying the Cashier core.

1 like
Mick79's avatar

Thanks a lot for the answer :-)

Mick79's avatar

I did not know about the coupon thing! That is excellent!

Please or to participate in this conversation.