I overrided the syncStripeCustomerDetails() method in my Billable model.
/**
* Sync the customer's information to Stripe.
*
* @return \Stripe\Customer
*/
public function syncStripeCustomerDetails()
{
$licenseInvoicingAddress = $this->company->licenseInvoicingAddress;
// dd([
// 'name' => $licenseInvoicingAddress->name,
// 'email' => $licenseInvoicingAddress->email,
// 'phone' => $licenseInvoicingAddress->phone,
// 'address' => $licenseInvoicingAddress->getFormattedAddress(),
// ]);
return $this->updateStripeCustomer([
'name' => $licenseInvoicingAddress->name,
'email' => $licenseInvoicingAddress->email,
'phone' => $licenseInvoicingAddress->phone,
'address' => $licenseInvoicingAddress->getFormattedAddress(),
]);
}
The dd test code returns the correct information.
If I recall correctly, this exact same code worked fine until a couple of weeks ago, maybe something changed on Stripe ?
I also did a composer update, but nothing changed.
When this method is called, I get this exception :
message: "Invalid object", exception: "Stripe\Exception\InvalidRequestException",…}
exception: "Stripe\Exception\InvalidRequestException"
file: "D:\xampp\htdocs\dental-manager\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php"
line: 38
message: "Invalid object"
Maybe instead I should override all the customer information methods (like stripeName() etc...)... even though on the documentation it is written that it should also be possible to directly override syncStripeCustomerDetails() ?
Also note I'm using Stripe in test mode, maybe that does not allow to update customers ?