Merchant API'de gelişmiş hesapların başka bir hesapla alt hesap ilişkisi olabilir. Alt hesaplar, birden fazla satıcı ve geniş ölçekli alanları (ör. birden fazla ülkede faaliyet gösteren perakendeciler) yöneten işletmelere yardımcı olur. Gelişmiş hesaba uygun işletme türleri için Gelişmiş hesap ayarlarına erişmeye uygun şirketler başlıklı makaleyi inceleyin.
Gelişmiş hesabınızın altında yeni alt hesaplar oluşturmak için Merchant Accounts API'yi kullanabilirsiniz. Bu aramayı yapmak için mevcut bir gelişmiş hesabınız olmalıdır. Mevcut bağımsız satıcı hesaplarını hesabınızın altına taşımak için Merchant API'yi kullanamazsınız.
Merchant Center hesabınızı gelişmiş hesaba dönüştürmek için hesap yöneticisi olmanız gerekir. Hesabınızda bekleyen sorun olmadığından da emin olmanız gerekir. Gelişmiş hesap alma hakkında bilgi edinmek için Gelişmiş hesap kurulumu için istekte bulunma başlıklı makaleyi inceleyin.
Üçüncü taraf sağlayıcılar, satıcıların hesap ayrıntılarını oluşturup yönetmelerine olanak tanıyan bir arayüz geliştirmek için Satıcı Hesapları API'sini kullanabilir.
Alt hesap oluşturma
Gelişmiş hesabınızın altında yeni bir alt hesap oluşturmak için accounts.createAndConfigure
numaralı telefonu arayın:
account
alanında alt hesabın ayrıntılarını girin.users
alanında yeni yetkili kullanıcıları belirtin. Kullanıcı erişimi de üst hesaptan devralınır.service
alanınaaccountAggregation
belirtin.Aşağıda, alt hesap için bir toplayıcı olan
account/123
hesabı altında alt hesap oluşturma örneği verilmiştir:POST https://merchantapi.googleapis.com/accounts/v1beta/accounts:createAndConfigure { "account": { "accountName": "merchantStore", "adultContent": false, "testAccount": false, "timeZone": { "id": "America/New_York", } "languageCode": "en-US", }, "service": [ { "accountAggregation": {}, "provider": "providers/123" } ] }
Aşağıdaki örnekte, yeni bir alt hesap oluşturmak için CreateAndConfigureAccountRequest
paketini nasıl kullanabileceğiniz gösterilmektedir.
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.Account;
import com.google.shopping.merchant.accounts.v1beta.AccountAggregation;
import com.google.shopping.merchant.accounts.v1beta.AccountsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.AccountsServiceSettings;
import com.google.shopping.merchant.accounts.v1beta.CreateAndConfigureAccountRequest;
import com.google.shopping.merchant.accounts.v1beta.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 MCA 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 MCA 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);
}
}
Alt hesapları alma
Belirli bir çok müşterili hesabın tüm alt hesaplarını listelemek için accounts.listSubaccounts
yöntemini kullanın.
Aşağıda örnek bir istek verilmiştir:
GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}:listSubaccounts
Başarılı bir aramadan alınan örnek yanıtı aşağıda bulabilirsiniz:
{
"accounts": [
{
"name": "accounts/{ACCOUNT_ID}",
"accountId": "{ACCOUNT_ID}",
"accountName": "{ACCOUNT_NAME}",
"timeZone": {
"id": "America/Los_Angeles"
},
"languageCode": "en-US"
},
{
"name": "accounts/{ACCOUNT_ID}",
"accountId": "{ACCOUNT_ID}",
"accountName": "{ACCOUNT_NAME}",
"timeZone": {
"id": "America/Los_Angeles"
},
"languageCode": "en-US"
}
]
}
Alt hesap silme
Bir alt hesabı silmek için accounts.delete
yöntemini kullanın. Bu yöntemin uygulanması için yönetici erişimi gerekir.
Aşağıda örnek bir istek verilmiştir:
DELETE https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}
Başarılı olursa yanıt metni boş bir JSON nesnesi olur.
Hizmet Şartları'nı kabul edin
Alt hesaplar, üst hesabın imzaladığı Merchant Center Hizmet Şartları'nı (HŞ) devralır.
İşletme bilgilerinizi güncelleme
İşletme bilgilerinizi düzenlemek için Merchant Accounts API'yi kullanabilirsiniz.
- İşletme bilgilerinizi görüntülemek için
accounts.getBusinessInfo
numaralı telefonu arayın. - İşletme bilgilerinizi düzenlemek için
accounts.updateBusinessInfo
numaralı telefonu arayın.