You can use Merchant API to create Merchant Center accounts, which can be
linked to an advanced account
by using accountAggregation
, accountManagement
or comparisonShopping
. The accounts.createAndConfigure
method lets you create an account and optionally configure it with users and
link it to other accounts through services.
This guide explains how to use Merchant API to create accounts
using services such as accountManagement
, comparisonShopping
, or accountAggregation
. When using accounts.createAndConfigure
, you must link the new account to a provider by
specifying at least one of accountAggregation
, accountManagement
, or comparisonShopping
in the service
field.
You can specify accountAggregation
and comparisonShopping
in the same
request, but accountManagement
cannot be combined with either accountAggregation
or comparisonShopping
.
If you specify accountManagement
, you must also add at least one user to
the new account using the user
or users
field.
Prerequisites
Before you can create accounts using Merchant API, ensure you meet the following requirements depending on the services you use:
- Administrator access: You must have administrator access to the
provider account when linking a new account using
accountManagement,comparisonShopping, oraccountAggregation. - Advanced account: If you use
accountAggregation, your provider account must be an advanced account configured for account aggregation. If you are a service provider and need to set up an advanced account, reach out to support for assistance with configuration.
Create an account (using account management or comparison shopping)
To create a new account, call accounts.createAndConfigure
.
This is the recommended approach for partners helping merchants manage their
accounts, as it allows merchants to retain full control and ownership of their
account while granting specific permissions to partners.
In the request body:
- Provide the details of the account you want to create in the
accountfield. - If you are using
accountManagement, specify at least one user in theuserfield who will have access to the account. - In the
servicefield, specify any services you want to provide to this account, for exampleaccountManagement, and set theproviderto the resource name of your account (for example,providers/ {YOUR_ACCOUNT_ID}). See Manage account relationships for a list of available services such asproductsManagementorcampaignsManagement.
Here's an example request to create an account named "merchantStore"
and link it to account {YOUR_ACCOUNT_ID}
for
account and product management:
POST https://merchantapi.googleapis.com/accounts/v1/accounts:createAndConfigure
{
"account": {
"accountName": "merchantStore",
"adultContent": false,
"timeZone": {
"id": "America/New_York"
},
"languageCode": "en-US"
},
"user": [
{
"userId": "test@example.com",
"user": {
"accessRights": ["ADMIN"]
}
}
],
"service": [
{
"accountManagement": {},
"provider": "providers/ {YOUR_ACCOUNT_ID}
"
},
{
"productsManagement": {},
"provider": "providers/ {YOUR_ACCOUNT_ID}
"
}
]
}
A successful call creates the new account and links it to your account for the
specified services. If you specify accountManagement
, accountAggregation
,
or comparisonShopping
services during creation, they are automatically
approved and the link state is ESTABLISHED
. Other service links might be in PENDING
state until accepted by the created account. The response body
contains the newly created Account
resource.
After creating such an account, you need to onboard it by performing steps such as accepting Terms of Service , setting up business information , and verifying website .
Suppress email verification during account creation
When creating an account with accounts.createAndConfigure
, you can optionally
suppress verification emails for new users added using the user
field by
setting verificationMailSettings.verificationMailMode
to SUPPRESS_VERIFICATION_MAIL
in the request for that user. This is useful if you
intend to verify users on behalf of the merchant immediately after creation
using the users.verifySelf
method. By default, verificationMailMode
is SEND_VERIFICATION_MAIL
, and
verification emails are sent to new users added during account creation.
POST https://merchantapi.googleapis.com/accounts/v1/accounts:createAndConfigure
{
"account": {
"accountName": "merchantStore",
"adultContent": false,
"timeZone": {
"id": "America/New_York"
},
"languageCode": "en-US"
},
"user": [
{
"userId": "test@example.com",
"user": {
"accessRights": ["ADMIN"]
},
"verificationMailSettings": {
"verificationMailMode": "SUPPRESS_VERIFICATION_MAIL"
}
}
],
"service": [
{
"accountManagement": {},
"provider": "providers/ {YOUR_ACCOUNT_ID}
"
}
]
}
If you set verificationMailMode
to SUPPRESS_VERIFICATION_MAIL
, you need to
call users.verifySelf
for each user added during creation to complete
verification. This call must be authenticated as the user being verified
(the user specified in userId
), for example using an OAuth token from the
user.
Specify an alias during account creation
You can specify an alias for an account in the context of a provider in CreateAndConfigureAccountRequest
using the setAlias
field. The alias can be
used to identify the account in your system. If you are a service provider, you
can use the alias to retrieve the account using GET /accounts/v1/accounts/{provider}~{alias}
. The alias must be unique for a
given provider, and you must specify a service with the same provider in the service
field of the request. For more information on alias requirements,
see Manage account relationships
.
POST https://merchantapi.googleapis.com/accounts/v1/accounts:createAndConfigure
{
"account": {
"accountName": "merchantStore",
"adultContent": false,
"timeZone": {
"id": "America/New_York"
},
"languageCode": "en-US"
},
"service": [
{
"accountManagement": {},
"provider": "providers/ {YOUR_ACCOUNT_ID}
"
}
],
"setAlias": [
{
"provider": "providers/ {YOUR_ACCOUNT_ID}
",
"accountIdAlias": "my-merchant-alias"
}
]
}
Recommended onboarding flow
If you are a partner creating an account on behalf of a merchant, we recommend the following flow:
- Create account: Call
accounts.createAndConfigurewith your partner credentials to create a new account.- Set
serviceto includeaccountManagementlinking to your provider ID. - Add the merchant as a user using the
userfield, and setverificationMailSettings.verificationMailModetoSUPPRESS_VERIFICATION_MAIL.
- Set
- Verify user: With credentials from the merchant (for example, using an
OAuth token), call
users.verifySelfto change the user state fromPENDINGtoVERIFIED. - Set business country: With merchant credentials, set the business
country by updating
address.regionCodeusingaccounts.updateBusinessInfo. This is required before accepting Terms of Service. - Accept Terms of Service: With merchant credentials, accept the Terms of Service .
This flow allows a merchant to be seamlessly onboarded within your platform without receiving invitation emails from Google.
Create a client account (using account aggregation)
Client accounts are distinct Merchant Center accounts linked to your advanced
account using the accountAggregation
service, allowing for centralized
management while maintaining separate settings, websites, and data feeds.
You can use the Merchant Accounts sub-API to create new client accounts.
To create client accounts, you must first have an advanced account setup . You must be an account administrator to convert your Merchant Center account to an advanced account, and your account must not have any pending issues .
To create a new client account, call accounts.createAndConfigure
.
In the request body:
- Provide the details of the account you want to create in the
accountfield. - Optionally, specify any new authorized users in the
userfield. User access for the account is also inherited from the parent advanced account. - In the
servicefield, specifyaccountAggregationand set theproviderto the resource name of your advanced account (for example,providers/ {ADVANCED_ACCOUNT_ID}). This establishes your advanced account as the aggregator for the new account.
Here's an example request to create a client account named "merchantStore"
linked to the advanced account {ADVANCED_ACCOUNT_ID}
:
POST https://merchantapi.googleapis.com/accounts/v1/accounts:createAndConfigure
{
"account": {
"accountName": "merchantStore",
"adultContent": false,
"timeZone": {
"id": "America/New_York"
},
"languageCode": "en-US"
},
"service": [
{
"accountAggregation": {},
"provider": "providers/ {ADVANCED_ACCOUNT_ID}
"
}
]
}
A successful call creates the new client account and links it to your specified
advanced account. The response body will contain the newly created Account
resource.
The following samples demonstrate how you can use the accounts.createAndConfigure
to create
a new client account.
Java
import
com.google.api.gax.core.FixedCredentialsProvider
;
import
com.google.auth.oauth2.GoogleCredentials
;
import
com.google.shopping.merchant.accounts.v1.Account
;
import
com.google.shopping.merchant.accounts.v1.AccountAggregation
;
import
com.google.shopping.merchant.accounts.v1.AccountsServiceClient
;
import
com.google.shopping.merchant.accounts.v1.AccountsServiceSettings
;
import
com.google.shopping.merchant.accounts.v1.CreateAndConfigureAccountRequest
;
import
com.google.shopping.merchant.accounts.v1.CreateAndConfigureAccountRequest.AddAccountService
;
import
com.google.type.TimeZone
;
import
shopping.merchant.samples.utils.Authenticator
;
import
shopping.merchant.samples.utils.Config
;
/** This class demonstrates how to create a sub-account under an advanced account. */
public
class
CreateSubAccountSample
{
private
static
String
getParent
(
String
accountId
)
{
return
String
.
format
(
"accounts/%s"
,
accountId
);
}
public
static
void
createSubAccount
(
Config
config
)
throws
Exception
{
// Obtains OAuth token based on the user's configuration.
GoogleCredentials
credential
=
new
Authenticator
().
authenticate
();
// Creates service settings using the credentials retrieved above.
AccountsServiceSettings
accountsServiceSettings
=
AccountsServiceSettings
.
newBuilder
()
.
setCredentialsProvider
(
FixedCredentialsProvider
.
create
(
credential
))
.
build
();
// Creates parent/provider to identify the advanced account into which to insert the subaccount.
String
parent
=
getParent
(
config
.
getAccountId
().
toString
());
// Calls the API and catches and prints any network failures/errors.
try
(
AccountsServiceClient
accountsServiceClient
=
AccountsServiceClient
.
create
(
accountsServiceSettings
))
{
CreateAndConfigureAccountRequest
request
=
CreateAndConfigureAccountRequest
.
newBuilder
()
.
setAccount
(
Account
.
newBuilder
()
.
setAccountName
(
"Demo Business"
)
.
setAdultContent
(
false
)
.
setTimeZone
(
TimeZone
.
newBuilder
().
setId
(
"America/New_York"
).
build
())
.
setLanguageCode
(
"en-US"
)
.
build
())
.
addService
(
AddAccountService
.
newBuilder
()
.
setProvider
(
parent
)
.
setAccountAggregation
(
AccountAggregation
.
getDefaultInstance
())
.
build
())
.
build
();
System
.
out
.
println
(
"Sending Create SubAccount request"
);
Account
response
=
accountsServiceClient
.
createAndConfigureAccount
(
request
);
System
.
out
.
println
(
"Inserted Account Name below"
);
// Format: `accounts/{account}
System
.
out
.
println
(
response
.
getName
());
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Config
config
=
Config
.
load
();
createSubAccount
(
config
);
}
}
PHP
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Account;
use Google\Shopping\Merchant\Accounts\V1\AccountAggregation;
use Google\Shopping\Merchant\Accounts\V1\Client\AccountsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\CreateAndConfigureAccountRequest;
use Google\Shopping\Merchant\Accounts\V1\CreateAndConfigureAccountRequest\AddAccountService;
use Google\Type\TimeZone;
/**
* This class demonstrates how to create a sub-account under an MCA account.
*/
class CreateSubAccount
{
private static function getParent(string $accountId): string
{
return sprintf("accounts/%s", $accountId);
}
public static function createSubAccount(array $config): void
{
// Gets the OAuth credentials to make the request.
$credentials = Authentication::useServiceAccountOrTokenFile();
// Creates options config containing credentials for the client to use.
$options = ['credentials' => $credentials];
// Creates a client.
$accountsServiceClient = new AccountsServiceClient($options);
// Creates parent/provider to identify the MCA account into which to insert the subaccount.
$parent = self::getParent($config['accountId']);
// Calls the API and catches and prints any network failures/errors.
try {
$request = new CreateAndConfigureAccountRequest([
'account' => (new Account([
'account_name' => 'Demo Business',
'adult_content' => false,
'time_zone' => (new TimeZone(['id' => 'America/New_York'])),
'language_code' => 'en-US',
])),
'service' => [
(new AddAccountService([
'provider' => $parent,
'account_aggregation' => new AccountAggregation,
])),
],
]);
print "Sending Create SubAccount request\n";
$response = $accountsServiceClient->createAndConfigureAccount($request);
print "Inserted Account Name below\n";
// Format: `accounts/{account}
print $response->getName() . PHP_EOL;
} catch (ApiException $e) {
print $e->getMessage();
}
}
public function callSample(): void
{
$config = Config::generateConfig();
self::createSubAccount($config);
}
}
$sample = new CreateSubAccount();
$sample->callSample();

