Page Summary
-
Merchant accounts can be linked through various relationships, defining the services one account provides to another.
-
Each relationship includes a service provider, an external account ID, a service recipient, and the service(s) offered.
-
A primary relationship type is "account aggregation," where an aggregator (like an advanced account) provides services to sub-accounts.
-
The
servicetype specifies the access level granted to the service provider, such as admin access in account aggregation. -
Advanced accounts can manage sub-accounts, enabling third-party platforms to manage merchants under their hierarchy.
You can use the Accounts API to manage the relationships between your Merchant Center account and other service providers. A relationship is a formal connection that enables a provider to offer specific services to your business. A service defines the permissions and capabilities granted to the provider, such as product management or campaign management. For example, linking your Merchant Center account to a Google Ads account allows the Ads account to use your product data for running ad campaigns.
A relationship is composed of the following attributes:
- The Merchant Center account receiving the service
- The service provider
- The service or set of services being provided to the Merchant Center account
Alias
Service providers can associate an alias with accounts they service (this is the
equivalent of the seller_id field that was present in the
account
resource in Content API for Shopping). The alias can be assigned using the
optional account_id_alias field within the AccountRelationship resource and
serves as a custom identifier. The alias must consist of 1 to 50 characters
chosen from ASCII letters, decimal digits, hyphens, underscores, periods, or
tildes ([A-Za-z0-9_~.-]{1,50}).
The URL structure for accessing an account using its alias is
GET /accounts/v1/accounts/{provider}~{account_id_alias}.
Services
In the Accounts API, accounts can receive the following services. You can add many of these services during account creation.
Account aggregation: This service links an advanced account to another account, granting the advanced account full, unrestricted access. It is typically used by marketplaces, multi-brand retailers, or international retailers who need centralized control over nested accounts. If you are an ecommerce platform or channel partner, we recommend using
accountManagementinstead. When you create an account using account aggregation, theexternalAccountIdmust be omitted.Campaign management: This service models the link between a Merchant Center account and a Google Ads account, giving the Ads account access to product and account data needed to run ad campaigns. The service provider in this case is
GOOGLE_ADSand theexternalAccountIdis the ID of the Google Ads account. This service can also be proposed to an existing account.
Comparison shopping: This represents the relationship with a Comparison Shopping Service (CSS) that operates the Merchant Center account.
Local listing management: This represents the relationship with a store manager for managing local inventory and listings using a Google Business Profile.
Account management: This service enables the provider to perform administrative actions on the Merchant Center account, such as configuring account settings, managing users, or updating business information. The business can also restrict the access granted. When used during account creation, this service creates an account linked to the provider, which is the recommended approach for ecommerce platforms and channel partners. It can also be proposed to an existing account.
Products management: This service allows providers to manage products and related features like data sources and rules. When added during account creation, it's typically in combination with
accountManagementoraccountAggregation. This service can also be proposed to an existing account.
Handshake
To establish a service, both the account providing the service and the account receiving the service must authorize the connection. This authorization process is called a handshake.
The handshake is a two-step process:
- One party proposes a service link.
- The other party approves or rejects the proposal.
Once a proposal has been accepted, the service is approved and considered fully established. Any access right conferred to the service provider is now granted to qualified users (See access rights below).
Note that the user creating a proposal, rejecting, or approving it must have
ADMIN access
rights
on the account initiating the process. So if the service provider
proposes a service, the user making the proposal must be an ADMIN on the
service provider's account and the user accepting or rejecting the proposal
must be an ADMIN on the receiving account.
The following samples demonstrate how to propose an account service:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.AccountService;
import com.google.shopping.merchant.accounts.v1.AccountServicesServiceClient;
import com.google.shopping.merchant.accounts.v1.AccountServicesServiceSettings;
import com.google.shopping.merchant.accounts.v1.ProductsManagement;
import com.google.shopping.merchant.accounts.v1.ProposeAccountServiceRequest;
import shopping.merchant.samples.utils.Authenticator;
/** This class demonstrates how to propose a service to an existing Merchant Center account. */
public class ProposeServiceSample {
public static void proposeService(long accountId, long providerId, String externalAccountId)
throws Exception {
// Obtains OAuth token based on the user's configuration.
// The user that authenticates should have access to the account.
GoogleCredentials credential = new Authenticator().authenticate();
// Creates service settings using the credentials retrieved above.
AccountServicesServiceSettings accountServicesServiceSettings =
AccountServicesServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Calls the API and catches and prints any network failures/errors.
try (AccountServicesServiceClient accountServicesServiceClient =
AccountServicesServiceClient.create(accountServicesServiceSettings)) {
// The service to be proposed.
// This sample shows how to propose product management.
// For more information about the different services, see:
// https://developers.google.com/merchant/api/guides/accounts/services
AccountService accountService =
AccountService.newBuilder()
.setProductsManagement(ProductsManagement.newBuilder().build())
.setExternalAccountId(externalAccountId)
.build();
String accountName =
AccountName.newBuilder().setAccount(String.valueOf(accountId)).build().toString();
ProposeAccountServiceRequest request =
ProposeAccountServiceRequest.newBuilder()
.setParent(accountName)
.setProvider("accounts/" + providerId)
.setAccountService(accountService)
.build();
System.out.println("Sending Propose Service request:");
AccountService response = accountServicesServiceClient.proposeAccountService(request);
System.out.println("Proposed Service below");
System.out.println(response);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
// The ID of the account to propose the service to.
long accountId = 123L;
// This is the provider ID of the e-commerce platform.
long providerId = 456L;
// An external ID that uniquely identifies the account service.
String externalAccountId = "ext-acc-id-123";
proposeService(accountId, providerId, externalAccountId);
}
}
PHP
require_once __DIR__ . '/../../../../vendor/autoload.php';
require_once __DIR__ . '/../../../Authentication/Authentication.php';
require_once __DIR__ . '/../../../Authentication/Config.php';
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\AccountAggregation;
use Google\Shopping\Merchant\Accounts\V1\AccountService;
use Google\Shopping\Merchant\Accounts\V1\Client\AccountServicesServiceClient;
use Google\Shopping\Merchant\Accounts\V1\ProposeAccountServiceRequest;
/**
* This class demonstrates how to propose an account service.
*/
class ProposeAccountServiceSample
{
/**
* A helper function to create the account name string.
*
* @param string $accountId The ID of the account.
*
* @return string The account name has the format: `accounts/{account_id}`
*/
private static function toAccountName(string $accountId): string
{
return sprintf('accounts/%s', $accountId);
}
/**
* Proposes a new account service.
*
* @param array $config The configuration data used for authentication and
* getting the account ID.
* @param string $providerId The ID of the provider account.
*/
public static function proposeAccountService(
array $config,
string $providerId
): void {
// Gets the OAuth credentials to make the request.
$credentials = Authentication::useServiceAccountOrTokenFile();
// Creates options containing credentials for the client to use.
$options = ['credentials' => $credentials];
// Creates a client.
$accountServicesServiceClient = new AccountServicesServiceClient($options);
// Calls the API and catches and prints any network failures/errors.
try {
$accountAggregation = new AccountAggregation();
$accountService = (new AccountService())
->setAccountAggregation($accountAggregation);
$request = (new ProposeAccountServiceRequest())
->setParent(self::toAccountName($config['accountId']))
->setProvider(self::toAccountName($providerId))
->setAccountService($accountService);
print "Sending Propose AccountService request\n";
$response = $accountServicesServiceClient->proposeAccountService($request);
print "Proposed AccountService below\n";
print $response->serializeToJsonString(true) . PHP_EOL;
} catch (ApiException $e) {
printf("An error has occurred: %s%s", $e->getMessage(), PHP_EOL);
}
}
/**
* Helper to execute the sample.
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Update this with the Merchant Center provider ID you want to get the
// relationship for.
$providerId = 111;
self::proposeAccountService($config, $providerId);
}
}
// Run the script
$sample = new ProposeAccountServiceSample();
$sample->callSample();
Python
"""This class demonstrates how to propose an account service."""
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import AccountAggregation
from google.shopping.merchant_accounts_v1 import AccountService
from google.shopping.merchant_accounts_v1 import AccountServicesServiceClient
from google.shopping.merchant_accounts_v1 import ProposeAccountServiceRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def propose_account_service(provider_id: int) -> None:
"""Proposes an account service.
Args:
provider_id: The Merchant Center ID of the provider.
"""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = AccountServicesServiceClient(credentials=credentials)
# Creates the provider resource name from the provider ID.
provider = f"accounts/{provider_id}"
# Creates an AccountService object.
# For this request, only `account_aggregation` is needed.
account_service = AccountService()
account_service.account_aggregation = AccountAggregation()
# Creates the request.
request = ProposeAccountServiceRequest(
parent=_PARENT,
provider=provider,
account_service=account_service,
)
# Makes the request and catches and prints any error messages.
try:
print("Sending Propose AccountService request")
response = client.propose_account_service(request=request)
print("Proposed AccountService below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
# Update this with the Merchant Center provider ID you want to get the
# relationship for.
provider_id_ = 111
propose_account_service(provider_id_)
Service-specific handshake behavior
The following is a description of the specific handshake requirements for each individual service:
Account aggregation: This service can only be established as part of account creation. The service provider is expected to be an advanced account, and the service is automatically approved since users of the advanced account have full
ADMINaccess to the account being created.Comparison shopping: This service is automatically approved when added during account creation using
createAndConfigure.Campaign management: While this follows the normal handshake process, proposals are made in one system (for example Google Ads) and approvals are done in the other system (for example in Merchant Center or through the Merchant API).
Local listing management: For this service, handshake is proposed in a dedicated method and approvals are done in the other system (for example Google Business Profile). Detailed steps are in the Guide to link a Google Business Profile.
Account management: For this service, the regular handshake process applies when using
propose. If the service is added during account creation usingcreateAndConfigure, it is automatically approved.Products management: For this service, the regular handshake process applies (proposed by one party, followed by acceptance from the other).
Access rights
Each service type provides a certain level of access for users of the service provider over the account being serviced:
Account aggregation: This service provides full
ADMINrights.Campaign management: This service provides a restricted access right, allowing the associated Ads account to access products and basic account information.
Comparison shopping: This service provides, by default, full
ADMINrights. However, the business can restrict the access granted in Merchant Center.Local listing management: This service provides no direct access right. Instead, it enables the listing to synchronize its products with the Merchant Center account.
Important: The access rights described for the following service types apply
only to approved service providers. Reach out to our support
team if you are a
service provider and want to make use of this capability. If you were already
previously approved for the accounts.link method for products management in
Content API for Shopping, you can use this service in Merchant API without
further approvals.
Account management: This service provides, by default, full
ADMINrights.Products management: This service provides full
ADMINrights. Note that in the future, this will be limited to only product-related access rights.
How relationships apply for third-party platforms
If you are a third-party platform that manages accounts on behalf of other businesses, the following shows how the different concepts map to your account structure:
- Service provider: Your advanced account.
- Account receiving the service: A Merchant Center account that represents the business you manage.
- Service:
accountManagement: This is the recommended service for ecommerce platforms and channel partners creating new accounts on behalf of merchants. It creates an account that the merchant owns, linked to you for management. This aligns with the preferred Merchant Center structure for this use case.accountAggregation: This service links your advanced account to another account. While supported, it is not recommended for ecommerce platforms and channel partners.
For details about how to set up an advanced account and link to new Merchant Center accounts, see Create accounts.