Merchant API में, खातों का एक-दूसरे के साथ सब-खाता संबंध हो सकता है. Merchant Center खाते के लिए उपलब्ध Merchant Accounts API का इस्तेमाल करके, अपने ऐडवांस खाते में नए उप-खाते बनाए जा सकते हैं. यह कॉल करने के लिए, आपके पास पहले से कोई बेहतर खाता होना चाहिए. Merchant API का इस्तेमाल करके, कारोबारी या कंपनी के मौजूदा स्टैंडअलोन खातों को अपने खाते में ट्रांसफ़र नहीं किया जा सकता.
तीसरे पक्ष की सेवा देने वाली कंपनियां, Merchant Center खाते के एपीआई का इस्तेमाल करके ऐसा इंटरफ़ेस बना सकती हैं जिसकी मदद से व्यापारी/कंपनी/कारोबारी अपने खाते की जानकारी बनाएं और मैनेज कर सकें.
उप-खाता बनाना
अपने बेहतर खाते में नया उप-खाता बनाने के लिए, accounts.createAndConfigure
को कॉल करें:
account
फ़ील्ड में, सब-खाते की जानकारी दें.users
फ़ील्ड में, अनुमति वाले नए उपयोगकर्ताओं की जानकारी दें. उपयोगकर्ता का ऐक्सेस भी पैरंट खाते से इनहेरिट किया जाता है.service
फ़ील्ड मेंaccountAggregation
डालें.खाते
account/123
के तहत सब-खाता बनाने का उदाहरण यहां दिया गया है. यह सब-खाते के लिए एग्रीगेटर है: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" } ] }
नीचे दिए गए सैंपल में, नया सब-खाता बनाने के लिए, CreateAndConfigureAccountRequest
पैकेज का इस्तेमाल करने का तरीका बताया गया है.
Java
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);
}
}
सेवा की शर्तें स्वीकार करना
उप-खातों पर, Merchant Center की सेवा की शर्तें (एसटीओ) लागू होती हैं. इन शर्तों पर, पैरंट खाते ने हस्ताक्षर किए होते हैं.
अपने कारोबार की जानकारी अपडेट करना
कारोबार की जानकारी में बदलाव करने के लिए, Merchant Center API का इस्तेमाल किया जा सकता है.
- अपने कारोबार की जानकारी देखने के लिए,
accounts.getBusinessInfo
पर कॉल करें. - अपने कारोबार की जानकारी में बदलाव करने के लिए,
accounts.updateBusinessInfo
पर कॉल करें.