php - Laravel Stripe Setup

one text

Solution:

You can remove customer email from the StripeCustomer when creating since stripe API said that email field of customer is optional. Here is the reference link

Here what you should fix:

$customerObject = [
    'description' => $company->name,
    'metadata' => [
        'company_id' => $company->id,
        'company_name' => $company->name,
    ],
];
if ($currentCustomer->email) {
    $customerMetadata["metadata"]["card_owner_email"] = $currentCustomer->email;
    $customerObject["email"] = $currentCustomer->email;
}
$stripeCustomer = StripeCustomer::create($customerObject);

Source