NikolaGavric94 / laravel-square

Square integration with Laravel/Lumen >=5.5
MIT License
31 stars 23 forks source link

Charge with old customer issue #70

Closed spaze-sushilthapa98 closed 2 years ago

spaze-sushilthapa98 commented 2 years ago

I wanted to charge a customer already created. I passed the customer instance as following:

$customer = $this->hasCustomer($this->email);
if(!$customer){
   $customer = [
        'first_name' => $firstName,
        'last_name' => $lastName,
        'email' => $this->email,
        'phone' => $this->phone,
   ];
}
$user->charge($subTotal, $sourceId, $locationId, $options, $customer, $currency);

Doing so, i get the following error TypeError: Argument 2 passed to Square\Apis\CustomersApi::updateCustomer() must be an instance of Square\Models\UpdateCustomerRequest, instance of Square\Models\CreateCustomerRequest given