← Posts

Update Customer in Stripe using Laravel Cashier

June 6th, 2019 - 1 min read

Heads up! This post was published a while back, so while some of it might still be good, I can't say for sure it's all accurate. Take it with a pinch of salt!

I've just had the situation where I needed to setup my Laravel app to update my customer's information in Stripe when they change it in my app.

The method I used to do this is actually undocumented on the official Laravel Cashier documentation, I found it while I was looking through the Cashier code.

In my Settings controller I used the following code to update the customer's name and email when they resubmit the settings form.

1$stripeData = array(
2 'name' => $user->first_name . ' ' . $user->last_name,
3 'email' => $user->email
4);
5 
6$user->updateStripeCustomer($stripeData);

That code should work as long as the User model has the Billable trait.