I run a platform where we use Stripe Connect (custom accounts) to manage platform payments and payouts. On a previous version of the API the following code worked fine.
// Company Details
$account->legal_entity->business_name = $data['business_name'];
$account->legal_entity->business_tax_id = $data['business_tax_id'];
// Legal entity personal details
$account->legal_entity->first_name = $data['first_name'];
$account->legal_entity->last_name = $data['last_name'];
However on a more recent version of the Stripe API (2019-09-09) this no longer works because as I discovered Stripe changed the accounts API. The new mappings are described here: https://stripe.com/docs/connect/required-updates/accounts-arguments
Based on this the following code should work:
// Company Details
$account->company->name = $data['business_name'];
$account->company->tax_id = $data['business_tax_id'];
// Legal entity personal details
$account->individual->first_name = $data['first_name'];
$account->individual->last_name = $data['last_name'];
But this doesn't work and I get the following message:
Creating default object from empty value
I am at a loss, have I misunderstood the new accounts API. Any helps is always appreciated.