Google content api issue

57 views
Skip to first unread message

amit ibhejo

unread,
May 5, 2022, 3:06:57 AM5/5/22
to Google Content API for Shopping
Hi Team,

I am getting below error message,  i checked credential.json file is perfect,  please help in this 

"User cannot access account merchant id"

<?php

require_once __DIR__.'/vendor/autoload.php';

putenv('GOOGLE_APPLICATION_CREDENTIALS='.__DIR__.'/service-account.json');
$client = new Google\Client();
$client->useApplicationDefaultCredentials();

//echo __DIR__.'/';

//exit();

// $sqladmin = new Google\Service\SQLAdmin($client);
// $response = $sqladmin->instances
//     ->listInstances('examinable-example-123')->getItems();
// echo json_encode($response) . "\n";

$client->addScope('https://www.googleapis.com/auth/content');

$service = new Google\Service\ShoppingContent($client);

$product = new Google_Service_ShoppingContent_Product();
$product->setOfferId('book123');
$product->setTitle('A Tale of Two Cities');
$product->setDescription('A classic novel about the French Revolution');
$product->setLink('http://my-book-shop.com/tale-of-two-cities.html');
$product->setImageLink('http://my-book-shop.com/tale-of-two-cities.jpg');
$product->setContentLanguage('en');
$product->setTargetCountry('GB');
$product->setChannel('online');
$product->setAvailability('in stock');
$product->setCondition('new');
$product->setGoogleProductCategory('Media > Books');
$product->setGtin('9780007350896');

$price = new Google_Service_ShoppingContent_Price();
$price->setValue('2.50');
$price->setCurrency('GBP');

$shipping_price = new Google_Service_ShoppingContent_Price();
$shipping_price->setValue('0.99');
$shipping_price->setCurrency('GBP');

$shipping = new Google_Service_ShoppingContent_ProductShipping();
$shipping->setPrice($shipping_price);
$shipping->setCountry('GB');
$shipping->setService('Standard shipping');

$shipping_weight = new Google_Service_ShoppingContent_ProductShippingWeight();
$shipping_weight->setValue(200);
$shipping_weight->setUnit('grams');

$product->setPrice($price);
$product->setShipping(array($shipping));
$product->setShippingWeight($shipping_weight);

$result = $service->products->insert('123456', $product);

//print_r($result);
  





Shopping API Forum Advisor

unread,
May 5, 2022, 11:07:08 PM5/5/22
to amitib...@gmail.com, google-content-...@googlegroups.com

Hi,

This is Ciara from the Content API support team. Thank you for reaching out on our public forum.

For us to investigate further, kindly provide us with the following information:

  1. Merchant account ID
  2. Complete API request and response logs in json format
  3. user email address used to make the request


You can provide it via the Reply privately to author option. If this option is not available, please send this requested information through our email <shopping-a...@google.com> instead for private purposes.

Looking forward to your response.

Regards,

Google Logo
Ciara
Content API for Shopping Team
 


ref:_00D1U1174p._5004Q2aQhLN:ref
Reply all
Reply to author
Forward
0 new messages