Category: Stripe

CashierLaravelPHPStripe

Laravel Cashier: Using default card as subscription payment

I’ve been busy implementing a subscription service for one of my projects. As it’s using Laravel I’ve been able to use Cashier for much of the scaffolding around Stripe payments.

In order to create a new subscription plan with Cashier, you would use:

$user->newSubscription('main', 'premium')->create($stripeToken);

However, if you have a user set up already with a default card (Eg, from a separated payment methods page). By removing the $stripeToken parameter Cashier/Stripe will create a subscription for the user using the user’s default card as payment.

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

This is a nice little conveniency that isn’t documented, saving you the hassle of asking for the user’s card details again when taking payment.