laravel-google-merchant-api
laravel-google-merchant-api copied to clipboard
Getting "Call to a member function request() on null" Error
I just configured everything, but when I try to get products it returns error like above.
"vendor/moirei/laravel-google-merchant-api/src/Api/AbstractApi.php:263"
I checked my client_credentials_path
and its reachable from any controllers.
What could be the main issue?
this occurs when you haven't selected your merchant account via OrderApi
or ProductApi::merchant('your-merchant')
this occurs when you haven't selected your merchant account via
OrderApi
orProductApi::merchant('your-merchant')
@h0lley can you please elaborate, it would be grateful.
We thought it would automatically pick our merchant credentials from config files. but its only working like this.
ProductApi::merchant([ 'merchant_id' => '1234567890', 'client_credentials_path' => storage_path('app/google-merchant-api/file-name.json') ])->insert(function($product){ $product->offerId(2) ->title('Purple Shoes 2') ->description('What are thooose!!') ->price(10); //->custom('purchase_quantity_limit', 1000) //->availabilityDate( Carbon::now()->addDays(7) ); })->then(function($response){ echo 'Product inserted'; })->otherwise(function($response){ echo 'Insert failed'; })->catch(function($e){ echo($e->getResponse()->getBody()->getContents()); });