Skip to content

Commit d4153a7

Browse files
feat: [ShoppingMerchantAccounts] Add CreateTestAccount RPC to Accounts service for creating test-only Merchant Center accounts (#9011)
* feat: Add CreateTestAccount RPC to Accounts service for creating test-only Merchant Center accounts docs: Update Account.account_name documentation for naming restrictions docs: Clarify CheckoutSettings.eligible_destinations usage docs: Refine DeveloperRegistration.developer_email behavior description docs: Add product-ratings to Program documentation docs: Update Region to support radius_area and clarify area type exclusivity docs: Improve TermsOfServiceKind.MERCHANT_CENTER comment docs: Update DeleteUser method description PiperOrigin-RevId: 884882604 Source-Link: googleapis/googleapis@e68f10a Source-Link: googleapis/googleapis-gen@95a7e13 Copy-Tag: eyJwIjoiU2hvcHBpbmdNZXJjaGFudEFjY291bnRzLy5Pd2xCb3QueWFtbCIsImgiOiI5NWE3ZTEzOWFmZDVmMjg2YzIzMjFiYjVlZDA4ZDNlZTIwZThiN2U1In0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 3090b8a commit d4153a7

20 files changed

Lines changed: 510 additions & 84 deletions

ShoppingMerchantAccounts/metadata/V1/Accounts.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ShoppingMerchantAccounts/samples/V1/AccountsServiceClient/create_and_configure_account.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
* Creates a Merchant Center account with additional configuration. Adds the
3535
* user that makes the request as an admin for the new account.
3636
*
37-
* @param string $accountAccountName A human-readable name of the account. See
38-
* [store name](https://support.google.com/merchants/answer/160556) and
39-
* [business name](https://support.google.com/merchants/answer/12159159) for
40-
* more information.
37+
* @param string $accountAccountName A human-readable name of the account. Don't use punctuation,
38+
* capitalization, or non-alphanumeric symbols such as the "/" or "_" symbols.
39+
* See
40+
* [Adding a business
41+
* name](https://support.google.com/merchants/answer/12159159) for more
42+
* information.
4143
* @param string $accountLanguageCode The account's [BCP-47 language
4244
* code](https://tools.ietf.org/html/bcp47), such as `en-US` or `sr-Latn`.
4345
* @param string $serviceProvider The provider of the service. Either the reference to an account
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START merchantapi_v1_generated_AccountsService_CreateTestAccount_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Shopping\Merchant\Accounts\V1\Account;
28+
use Google\Shopping\Merchant\Accounts\V1\Client\AccountsServiceClient;
29+
use Google\Shopping\Merchant\Accounts\V1\CreateTestAccountRequest;
30+
use Google\Type\TimeZone;
31+
32+
/**
33+
* Creates a Merchant Center test account.
34+
*
35+
* Test accounts are intended for development and testing purposes, such as
36+
* validating API integrations or new feature behavior.
37+
*
38+
* Key characteristics and limitations of test accounts:
39+
* - Immutable Type: A test account cannot be converted into a regular
40+
* (live) Merchant Center account. Likewise, a regular account cannot be
41+
* converted into a test account.
42+
* - Non-Serving Products: Any products, offers, or data created within a
43+
* test account will not be published or made visible to end-users on any
44+
* Google surfaces. They are strictly for testing environments.
45+
* - Separate Environment: Test accounts operate in a sandbox-like manner,
46+
* isolated from live serving and real user traffic.
47+
*
48+
* @param string $formattedParent The account resource name to create the test account under.
49+
* Format: accounts/{account}
50+
* Please see {@see AccountsServiceClient::accountName()} for help formatting this field.
51+
* @param string $accountAccountName A human-readable name of the account. Don't use punctuation,
52+
* capitalization, or non-alphanumeric symbols such as the "/" or "_" symbols.
53+
* See
54+
* [Adding a business
55+
* name](https://support.google.com/merchants/answer/12159159) for more
56+
* information.
57+
* @param string $accountLanguageCode The account's [BCP-47 language
58+
* code](https://tools.ietf.org/html/bcp47), such as `en-US` or `sr-Latn`.
59+
*/
60+
function create_test_account_sample(
61+
string $formattedParent,
62+
string $accountAccountName,
63+
string $accountLanguageCode
64+
): void {
65+
// Create a client.
66+
$accountsServiceClient = new AccountsServiceClient();
67+
68+
// Prepare the request message.
69+
$accountTimeZone = new TimeZone();
70+
$account = (new Account())
71+
->setAccountName($accountAccountName)
72+
->setTimeZone($accountTimeZone)
73+
->setLanguageCode($accountLanguageCode);
74+
$request = (new CreateTestAccountRequest())
75+
->setParent($formattedParent)
76+
->setAccount($account);
77+
78+
// Call the API and handle any network failures.
79+
try {
80+
/** @var Account $response */
81+
$response = $accountsServiceClient->createTestAccount($request);
82+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
83+
} catch (ApiException $ex) {
84+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
85+
}
86+
}
87+
88+
/**
89+
* Helper to execute the sample.
90+
*
91+
* This sample has been automatically generated and should be regarded as a code
92+
* template only. It will require modifications to work:
93+
* - It may require correct/in-range values for request initialization.
94+
* - It may require specifying regional endpoints when creating the service client,
95+
* please see the apiEndpoint client configuration option for more details.
96+
*/
97+
function callSample(): void
98+
{
99+
$formattedParent = AccountsServiceClient::accountName('[ACCOUNT]');
100+
$accountAccountName = '[ACCOUNT_NAME]';
101+
$accountLanguageCode = '[LANGUAGE_CODE]';
102+
103+
create_test_account_sample($formattedParent, $accountAccountName, $accountLanguageCode);
104+
}
105+
// [END merchantapi_v1_generated_AccountsService_CreateTestAccount_sync]

ShoppingMerchantAccounts/samples/V1/AccountsServiceClient/update_account.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
* Updates an account regardless of its type: standalone, advanced account or
3434
* sub-account. Executing this method requires admin access.
3535
*
36-
* @param string $accountAccountName A human-readable name of the account. See
37-
* [store name](https://support.google.com/merchants/answer/160556) and
38-
* [business name](https://support.google.com/merchants/answer/12159159) for
39-
* more information.
36+
* @param string $accountAccountName A human-readable name of the account. Don't use punctuation,
37+
* capitalization, or non-alphanumeric symbols such as the "/" or "_" symbols.
38+
* See
39+
* [Adding a business
40+
* name](https://support.google.com/merchants/answer/12159159) for more
41+
* information.
4042
* @param string $accountLanguageCode The account's [BCP-47 language
4143
* code](https://tools.ietf.org/html/bcp47), such as `en-US` or `sr-Latn`.
4244
*/

ShoppingMerchantAccounts/samples/V1/UserServiceClient/delete_user.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
/**
3131
* Deletes a Merchant Center account user. Executing this method requires
3232
* admin access. The user to be deleted can't be the last admin user of that
33-
* account. Also a user is protected from deletion if it
34-
* is managed by Business Manager"
33+
* account.
3534
*
3635
* @param string $formattedName The name of the user to delete.
3736
* Format: `accounts/{account}/users/{email}`

0 commit comments

Comments
 (0)