mhdev3's avatar

Cashier - customer name updates

Hello,

I'm using Laravel Cashier 15.7.1. I'm facing an issue where the customer name in Stripe is updating to be the name of the Cardholder, not the name of the Billable (which in my case is a Company).

I create the company in Stripe as a customer when they get added to my database;

$this->company->createAsStripeCustomer([
    'name' => $this->company->name,
    'address' => [
        'line1' => $this->company->address_line_one,
        'line2' => $this->company->address_line_two,
        'postal_code' => $this->company->address_postcode,
        'city' => $this->company->address_town,
        'country' => $this->company->country_code
      ]
 ]);
          

Then, when they go onto a paid subscription, I call the hosted checkout like so:

return $company
    ->newSubscription('default', config('cashier.prices.small')
    ->trialDays(self::TRIAL_DAYS)
    ->allowPromotionCodes()
    ->withMetadata([
        'foo' => 'bar',
    ])
    ->checkout([
        'success_url' => route('billing.success'),
        'cancel_url' => route('billing'),
    ]);

However, when the payment is made successfully in Stripe, the customer name in Stripe gets updated to be the name on the card, not the company name of my billable model when I created the Stripe customer. Am I missing something obvious, like being able to lock the customer name field?

1 like
5 replies
vincent15000's avatar

Have you tried to add this code in your billable model ?

public function stripeName(): ?string
{
    return $this->name;
}
mhdev3's avatar

Thanks. Tried this - unfortunately still updates to the cardholder name, rather than staying as the name of my Billable modal.

1 like
Jsanwo64's avatar
Jsanwo64
Best Answer
Level 11

What you’re seeing is usually not your createAsStripeCustomer() call being “ignored”. It’s Checkout updating the existing Stripe customer during the hosted flow. Stripe’s Checkout docs say that when you pass an existing customer, Checkout can update that customer with changes from the session, and Stripe’s tax docs specifically mention customer_update.name = auto as the mechanism that updates the customer’s saved name from Checkout data.

With Laravel Cashier, this often happens when tax collection / automatic tax is involved. Cashier has had logic around Checkout that sets:

customer_update.address = 'auto'

customer_update.name = 'auto'

for Checkout sessions in certain tax-related cases, and Cashier’s changelog explicitly mentions a fix for “Tax ID collection requires updating business name on the customer.”

So, no, you’re probably not missing an obvious “lock the customer name” setting in Cashier. The name is being overwritten by Checkout session behavior, not by your initial customer creation.

Inspect and override Checkout session data

If Cashier is injecting customer_update.name = auto, override it in the Checkout payload if your version/path allows it, for example:

return $company
    ->newSubscription('default', config('cashier.prices.small'))
    ->trialDays(self::TRIAL_DAYS)
    ->allowPromotionCodes()
    ->withMetadata([
        'foo' => 'bar',
    ])
    ->checkout([
        'success_url' => route('billing.success'),
        'cancel_url' => route('billing'),

        // try forcing Stripe not to overwrite the customer record
        'customer_update' => [
            'name' => 'never',
        ],
    ]);

The key idea is to prevent Checkout from treating the payer-entered/cardholder name as the canonical customer name. Stripe’s docs distinguish between auto and never behavior for customer_update fields.

Option B would be to say you Re-sync the Stripe customer after checkout completes If Cashier/Stripe still overwrites the name during Checkout, run a post-checkout correction:

$company->syncStripeCustomerDetails();

or even explicitly:

$company->updateStripeCustomer([
    'name' => $company->name,
]);

This is less elegant, but it is reliable when the hosted page insists on writing the payer/cardholder details back first. Cashier supports syncing customer details back to Stripe from your billable model.

2 likes
mhdev3's avatar

This is great, thank you. Unfortunately I couldn't get the customer_update field to work inside checkout() (had no effect), however updating the Stripe customer using this code:

$company->updateStripeCustomer([
    'name' => $company->name,
]);

Worked brilliantly.

Please or to participate in this conversation.