আপনি Merchant Center অ্যাকাউন্ট তৈরি করতে Merchant API ব্যবহার করতে পারেন, যা accountAggregation , accountManagement অথবা comparisonShopping ব্যবহার করে একটি উন্নত অ্যাকাউন্টের সাথে লিঙ্ক করা যেতে পারে। accounts.createAndConfigure পদ্ধতি আপনাকে একটি অ্যাকাউন্ট তৈরি করতে এবং ঐচ্ছিকভাবে ব্যবহারকারীদের সাথে এটি কনফিগার করতে এবং পরিষেবার মাধ্যমে অন্যান্য অ্যাকাউন্টের সাথে লিঙ্ক করতে দেয়।
এই নির্দেশিকাটি ব্যাখ্যা করে যে কীভাবে Merchant API ব্যবহার করে accountManagement , comparisonShopping , অথবা accountAggregation মতো পরিষেবা ব্যবহার করে অ্যাকাউন্ট তৈরি করবেন। accounts.createAndConfigure ব্যবহার করার সময়, আপনাকে service ক্ষেত্রে accountAggregation , accountManagement , অথবা comparisonShopping মধ্যে কমপক্ষে একটি নির্দিষ্ট করে নতুন অ্যাকাউন্টটি একটি প্রদানকারীর সাথে লিঙ্ক করতে হবে। আপনি একই অনুরোধে accountAggregation এবং comparisonShopping নির্দিষ্ট করতে পারেন, কিন্তু accountManagement accountAggregation বা comparisonShopping এর সাথে একত্রিত করা যাবে না। যদি আপনি accountManagement নির্দিষ্ট করেন, তাহলে আপনাকে user or users ফিল্ড ব্যবহার করে নতুন অ্যাকাউন্টে কমপক্ষে একজন ব্যবহারকারী যোগ করতে হবে।
পূর্বশর্ত
মার্চেন্ট এপিআই ব্যবহার করে অ্যাকাউন্ট তৈরি করার আগে, আপনার ব্যবহৃত পরিষেবার উপর নির্ভর করে নিম্নলিখিত প্রয়োজনীয়তাগুলি পূরণ করুন তা নিশ্চিত করুন:
- অ্যাডমিনিস্ট্রেটর অ্যাক্সেস :
accountManagement,comparisonShopping, অথবাaccountAggregationব্যবহার করে একটি নতুন অ্যাকাউন্ট লিঙ্ক করার সময় আপনার অবশ্যই প্রোভাইডার অ্যাকাউন্টে অ্যাডমিনিস্ট্রেটর অ্যাক্সেস থাকতে হবে। - উন্নত অ্যাকাউন্ট : যদি আপনি
accountAggregationব্যবহার করেন, তাহলে আপনার প্রদানকারী অ্যাকাউন্টটি অ্যাকাউন্ট একত্রিতকরণের জন্য কনফিগার করা একটি উন্নত অ্যাকাউন্ট হতে হবে। যদি আপনি একজন পরিষেবা প্রদানকারী হন এবং একটি উন্নত অ্যাকাউন্ট সেট আপ করতে চান, তাহলে কনফিগারেশনে সহায়তার জন্য সহায়তার সাথে যোগাযোগ করুন ।
একটি অ্যাকাউন্ট তৈরি করুন (অ্যাকাউন্ট ব্যবস্থাপনা বা তুলনামূলক কেনাকাটা ব্যবহার করে)
একটি নতুন অ্যাকাউন্ট তৈরি করতে, accounts.createAndConfigure কল করুন। এটি অংশীদারদের জন্য প্রস্তাবিত পদ্ধতি যারা ব্যবসায়ীদের তাদের অ্যাকাউন্ট পরিচালনা করতে সাহায্য করে, কারণ এটি ব্যবসায়ীদের তাদের অ্যাকাউন্টের সম্পূর্ণ নিয়ন্ত্রণ এবং মালিকানা ধরে রাখার অনুমতি দেয় এবং অংশীদারদের নির্দিষ্ট অনুমতি দেয়।
অনুরোধের মূল অংশে:
-
accountক্ষেত্রে আপনি যে অ্যাকাউন্টটি তৈরি করতে চান তার বিবরণ প্রদান করুন। - যদি আপনি
accountManagementব্যবহার করেন, তাহলেuserক্ষেত্রে কমপক্ষে একজন ব্যবহারকারী উল্লেখ করুন যার অ্যাকাউন্টে অ্যাক্সেস থাকবে। -
serviceক্ষেত্রে, এই অ্যাকাউন্টে আপনি যে কোনও পরিষেবা প্রদান করতে চান তা নির্দিষ্ট করুন, উদাহরণস্বরূপaccountManagement, এবংproviderআপনার অ্যাকাউন্টের রিসোর্স নামে সেট করুন (উদাহরণস্বরূপ,providers/ {YOUR_ACCOUNT_ID})।productsManagementবাcampaignsManagementএর মতো উপলব্ধ পরিষেবাগুলির তালিকার জন্য অ্যাকাউন্ট সম্পর্ক পরিচালনা করুন দেখুন।
অ্যাকাউন্ট এবং পণ্য পরিচালনার জন্য "merchantStore" নামে একটি অ্যাকাউন্ট তৈরি করে {YOUR_ACCOUNT_ID} অ্যাকাউন্টের সাথে লিঙ্ক করার একটি উদাহরণ এখানে দেওয়া হল:
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}"
}
]
}
একটি সফল কল নতুন অ্যাকাউন্ট তৈরি করে এবং নির্দিষ্ট পরিষেবাগুলির জন্য এটি আপনার অ্যাকাউন্টের সাথে লিঙ্ক করে। তৈরির সময় যদি আপনি accountManagement , accountAggregation , অথবা comparisonShopping পরিষেবাগুলি নির্দিষ্ট করেন, তাহলে সেগুলি স্বয়ংক্রিয়ভাবে অনুমোদিত হয় এবং লিঙ্কের অবস্থা ESTABLISHED হয়। তৈরি করা অ্যাকাউন্ট দ্বারা গৃহীত না হওয়া পর্যন্ত অন্যান্য পরিষেবা লিঙ্কগুলি PENDING অবস্থায় থাকতে পারে। প্রতিক্রিয়ার অংশে নতুন তৈরি Account রিসোর্স থাকে।
এই ধরনের একটি অ্যাকাউন্ট তৈরি করার পরে, আপনাকে পরিষেবার শর্তাবলী গ্রহণ , ব্যবসায়িক তথ্য সেট আপ এবং ওয়েবসাইট যাচাই করার মতো পদক্ষেপগুলি সম্পাদন করে এটিতে যোগদান করতে হবে।
অ্যাকাউন্ট তৈরির সময় ইমেল যাচাইকরণ বন্ধ করুন
accounts.createAndConfigure দিয়ে অ্যাকাউন্ট তৈরি করার সময়, আপনি ঐচ্ছিকভাবে ব্যবহারকারীর অনুরোধে verificationMailSettings.verificationMailMode কে SUPPRESS_VERIFICATION_MAIL এ সেট করে user ক্ষেত্র ব্যবহার করে নতুন ব্যবহারকারীদের জন্য যাচাইকরণ ইমেলগুলি দমন করতে পারেন। users.verifySelf পদ্ধতি ব্যবহার করে তৈরির পরপরই যদি আপনি ব্যবসায়ীর পক্ষ থেকে ব্যবহারকারীদের যাচাই করতে চান তবে এটি কার্যকর। ডিফল্টরূপে, verificationMailMode হল SEND_VERIFICATION_MAIL , এবং অ্যাকাউন্ট তৈরির সময় যোগ করা নতুন ব্যবহারকারীদের কাছে যাচাইকরণ ইমেল পাঠানো হয়।
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}"
}
]
}
যদি আপনি verificationMailMode কে SUPPRESS_VERIFICATION_MAIL এ সেট করেন, তাহলে যাচাইকরণ সম্পূর্ণ করার জন্য আপনাকে তৈরির সময় যোগ করা প্রতিটি ব্যবহারকারীর জন্য users.verifySelf কল করতে হবে। এই কলটি যাচাই করা ব্যবহারকারী ( userId এ উল্লেখিত ব্যবহারকারী) হিসাবে প্রমাণিত হতে হবে, উদাহরণস্বরূপ ব্যবহারকারীর কাছ থেকে একটি OAuth টোকেন ব্যবহার করে।
অ্যাকাউন্ট তৈরির সময় একটি উপনাম উল্লেখ করুন
আপনি setAlias ফিল্ড ব্যবহার করে CreateAndConfigureAccountRequest এ একটি প্রোভাইডারের প্রসঙ্গে একটি অ্যাকাউন্টের জন্য একটি উপনাম নির্দিষ্ট করতে পারেন। আপনার সিস্টেমে অ্যাকাউন্টটি সনাক্ত করতে এই উপনামটি ব্যবহার করা যেতে পারে। আপনি যদি একজন পরিষেবা প্রদানকারী হন, তাহলে আপনি GET /accounts/v1/accounts/{provider}~{alias} ব্যবহার করে অ্যাকাউন্টটি পুনরুদ্ধার করতে এই উপনামটি ব্যবহার করতে পারেন। প্রদত্ত প্রোভাইডারের জন্য উপনামটি অবশ্যই অনন্য হতে হবে এবং অনুরোধের service ক্ষেত্রে আপনাকে একই প্রোভাইডারের সাথে একটি পরিষেবা নির্দিষ্ট করতে হবে। উপনামের প্রয়োজনীয়তা সম্পর্কে আরও তথ্যের জন্য, অ্যাকাউন্ট সম্পর্ক পরিচালনা করুন দেখুন।
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"
}
]
}
প্রস্তাবিত অনবোর্ডিং প্রবাহ
আপনি যদি কোনও ব্যবসায়ীর পক্ষে অ্যাকাউন্ট তৈরির অংশীদার হন, তাহলে আমরা নিম্নলিখিত প্রবাহটি সুপারিশ করি:
- অ্যাকাউন্ট তৈরি করুন : একটি নতুন অ্যাকাউন্ট তৈরি করতে আপনার পার্টনার শংসাপত্রের সাথে
accounts.createAndConfigureএ কল করুন।- আপনার প্রোভাইডার আইডির সাথে
accountManagementলিঙ্কিং অন্তর্ভুক্ত করার জন্যserviceসেট করুন। -
userক্ষেত্রটি ব্যবহার করে ব্যবসায়ীকে ব্যবহারকারী হিসেবে যুক্ত করুন এবংverificationMailSettings.verificationMailModeSUPPRESS_VERIFICATION_MAILএ সেট করুন।
- আপনার প্রোভাইডার আইডির সাথে
- ব্যবহারকারী যাচাই করুন : মার্চেন্টের কাছ থেকে প্রাপ্ত শংসাপত্রের সাহায্যে (উদাহরণস্বরূপ, একটি OAuth টোকেন ব্যবহার করে), ব্যবহারকারীর অবস্থা
PENDINGথেকেVERIFIEDএ পরিবর্তন করতেusers.verifySelfএ কল করুন। - ব্যবসার দেশ নির্ধারণ করুন : মার্চেন্ট শংসাপত্রের সাহায্যে,
accounts.updateBusinessInfoব্যবহার করেaddress.regionCodeআপডেট করে ব্যবসার দেশ নির্ধারণ করুন। পরিষেবার শর্তাবলী গ্রহণ করার আগে এটি প্রয়োজন। - পরিষেবার শর্তাবলী গ্রহণ করুন : মার্চেন্ট শংসাপত্রের সাথে, পরিষেবার শর্তাবলী গ্রহণ করুন ।
এই প্রবাহের মাধ্যমে একজন বণিক Google থেকে আমন্ত্রণ ইমেল না পেয়েও আপনার প্ল্যাটফর্মে নির্বিঘ্নে যোগদান করতে পারবেন।
একটি ক্লায়েন্ট অ্যাকাউন্ট তৈরি করুন (অ্যাকাউন্ট একত্রীকরণ ব্যবহার করে)
ক্লায়েন্ট অ্যাকাউন্ট হল স্বতন্ত্র মার্চেন্ট সেন্টার অ্যাকাউন্ট যা আপনার অ্যাডভান্সড অ্যাকাউন্টের সাথে accountAggregation পরিষেবা ব্যবহার করে লিঙ্ক করা হয়, যা পৃথক সেটিংস, ওয়েবসাইট এবং ডেটা ফিড বজায় রেখে কেন্দ্রীভূত ব্যবস্থাপনার অনুমতি দেয়। আপনি নতুন ক্লায়েন্ট অ্যাকাউন্ট তৈরি করতে মার্চেন্ট অ্যাকাউন্টস সাব-এপিআই ব্যবহার করতে পারেন।
ক্লায়েন্ট অ্যাকাউন্ট তৈরি করতে, আপনার প্রথমে একটি উন্নত অ্যাকাউন্ট সেটআপ থাকতে হবে। আপনার মার্চেন্ট সেন্টার অ্যাকাউন্টকে একটি উন্নত অ্যাকাউন্টে রূপান্তর করতে আপনাকে অবশ্যই একজন অ্যাকাউন্ট প্রশাসক হতে হবে এবং আপনার অ্যাকাউন্টে কোনও মুলতুবি সমস্যা থাকা উচিত নয়।
একটি নতুন ক্লায়েন্ট অ্যাকাউন্ট তৈরি করতে, accounts.createAndConfigure এ কল করুন। অনুরোধের মূল অংশে:
-
accountক্ষেত্রে আপনি যে অ্যাকাউন্টটি তৈরি করতে চান তার বিবরণ প্রদান করুন। - ঐচ্ছিকভাবে,
userক্ষেত্রে নতুন অনুমোদিত ব্যবহারকারীদের উল্লেখ করুন। অ্যাকাউন্টের জন্য ব্যবহারকারীর অ্যাক্সেসও প্যারেন্ট অ্যাডভান্সড অ্যাকাউন্ট থেকে উত্তরাধিকারসূত্রে পাওয়া যায়। -
serviceক্ষেত্রে,accountAggregationউল্লেখ করুন এবং আপনার উন্নত অ্যাকাউন্টের (উদাহরণস্বরূপ,providers/ {ADVANCED_ACCOUNT_ID}) রিসোর্স নামেproviderসেট করুন। এটি আপনার উন্নত অ্যাকাউন্টটিকে নতুন অ্যাকাউন্টের জন্য সমষ্টি হিসেবে প্রতিষ্ঠিত করে।
"merchantStore" নামে একটি ক্লায়েন্ট অ্যাকাউন্ট তৈরি করার জন্য এখানে একটি উদাহরণ অনুরোধ দেওয়া হল যা {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}"
}
]
}
একটি সফল কল নতুন ক্লায়েন্ট অ্যাকাউন্ট তৈরি করে এবং এটি আপনার নির্দিষ্ট অ্যাডভান্সড অ্যাকাউন্টের সাথে লিঙ্ক করে। রেসপন্স বডিতে নতুন তৈরি Account রিসোর্স থাকবে।
নিম্নলিখিত নমুনাগুলি দেখায় যে কীভাবে আপনি accounts.createAndConfigure ব্যবহার করে একটি নতুন ক্লায়েন্ট অ্যাকাউন্ট তৈরি করতে পারেন।
জাভা
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);
}
}
পিএইচপি
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();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import Account
from google.shopping.merchant_accounts_v1 import AccountAggregation
from google.shopping.merchant_accounts_v1 import AccountsServiceClient
from google.shopping.merchant_accounts_v1 import CreateAndConfigureAccountRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
def get_parent(account_id):
return f"accounts/{account_id}"
def create_sub_account():
"""Creates a sub-account under an advanced account."""
# Get OAuth credentials.
credentials = generate_user_credentials.main()
# Create a client.
client = AccountsServiceClient(credentials=credentials)
# Get the parent advanced account ID.
parent = get_parent(_ACCOUNT)
# Create the request.
request = CreateAndConfigureAccountRequest(
account=Account(
account_name="Demo Business",
adult_content=False,
time_zone={"id": "America/New_York"},
language_code="en-US",
),
service=[
CreateAndConfigureAccountRequest.AddAccountService(
provider=parent,
account_aggregation=AccountAggregation(),
)
],
)
# Make the request and print the response.
try:
print("Sending Create SubAccount request")
response = client.create_and_configure_account(request=request)
print("Inserted Account Name below")
print(response.name)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
create_sub_account()
সিআরএল
curl -X POST \
"https://merchantapi.googleapis.com/accounts/v1/accounts:createAndConfigure" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"account": {
"accountName": "Demo Business",
"adultContent": false,
"timeZone": {
"id": "America/New_York"
},
"languageCode": "en-US"
},
"service": [
{
"accountAggregation": {},
"provider": "providers/{ADVANCED_ACCOUNT_ID}"
}
]
}'
ক্লায়েন্ট অ্যাকাউন্টগুলি পুনরুদ্ধার করুন
একটি প্রদত্ত অ্যাডভান্সড অ্যাকাউন্টের সমস্ত ক্লায়েন্ট অ্যাকাউন্ট তালিকাভুক্ত করতে, accounts.listSubaccounts পদ্ধতিটি ব্যবহার করুন। অনুরোধ URL এর provider ক্ষেত্রে আপনার অ্যাডভান্সড অ্যাকাউন্টের আইডি প্রদান করুন।
এখানে একটি নমুনা অনুরোধ:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ADVANCED_ACCOUNT_ID}:listSubaccounts
একটি সফল কলের নমুনা প্রতিক্রিয়া এখানে দেওয়া হল:
{
"accounts": [
{
"name": "accounts/<var class=\"readonly\">{SUB_ACCOUNT_ID_1}</var>",
"accountId": "<var class=\"readonly\">{SUB_ACCOUNT_ID_1}</var>",
"accountName": "<var class=\"readonly\">{SUB_ACCOUNT_NAME_1}</var>",
"timeZone": {
"id": "America/Los_Angeles"
},
"languageCode": "en-US"
},
{
"name": "accounts/<var class=\"readonly\">{SUB_ACCOUNT_ID_2}</var>",
"accountId": "<var class=\"readonly\">{SUB_ACCOUNT_ID_2}</var>",
"accountName": "<var class=\"readonly\">{SUB_ACCOUNT_NAME_2}</var>",
"timeZone": {
"id": "America/Los_Angeles"
},
"languageCode": "en-US"
}
]
}
নিম্নলিখিত নমুনাগুলি আপনার উন্নত অ্যাকাউন্টের সমস্ত ক্লায়েন্ট অ্যাকাউন্ট কীভাবে তালিকাভুক্ত করবেন তা প্রদর্শন করে।
জাভা
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.AccountsServiceClient;
import com.google.shopping.merchant.accounts.v1.AccountsServiceClient.ListSubAccountsPagedResponse;
import com.google.shopping.merchant.accounts.v1.AccountsServiceSettings;
import com.google.shopping.merchant.accounts.v1.ListSubAccountsRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to list all the subaccounts of an advanced account. */
public class ListSubAccountsSample {
private static String getParent(String accountId) {
return String.format("accounts/%s", accountId);
}
public static void listSubAccounts(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 from which to list all sub-accounts.
String parent = getParent(config.getAccountId().toString());
// Calls the API and catches and prints any network failures/errors.
try (AccountsServiceClient accountsServiceClient =
AccountsServiceClient.create(accountsServiceSettings)) {
// The parent has the format: accounts/{account}
ListSubAccountsRequest request =
ListSubAccountsRequest.newBuilder().setProvider(parent).build();
System.out.println("Sending list subaccounts request:");
ListSubAccountsPagedResponse response = accountsServiceClient.listSubAccounts(request);
int count = 0;
// Iterates over all rows in all pages and prints the datasource in each row.
// Automatically uses the `nextPageToken` if returned to fetch all pages of data.
for (Account account : response.iterateAll()) {
System.out.println(account);
count++;
}
System.out.print("The following count of accounts were returned: ");
System.out.println(count);
} catch (Exception e) {
System.out.println("An error has occured: ");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listSubAccounts(config);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\AccountsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\ListSubAccountsRequest;
/**
* This class demonstrates how to list all the subaccounts of an advanced account.
*/
class ListSubAccounts
{
private static function getParent(string $accountId): string
{
return sprintf("accounts/%s", $accountId);
}
public static function listSubAccounts(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 advanced account from which
//to list all accounts.
$parent = self::getParent($config['accountId']);
// Calls the API and catches and prints any network failures/errors.
try {
// The parent has the format: accounts/{account}
$request = new ListSubAccountsRequest(['provider' => $parent]);
print "Sending list subaccounts request:\n";
$response = $accountsServiceClient->listSubAccounts($request);
$count = 0;
// Iterates over all rows in all pages and prints the datasource in each row.
// Automatically uses the `nextPageToken` if returned to fetch all pages of data.
foreach ($response->iterateAllElements() as $account) {
print_r($account);
$count++;
}
print "The following count of accounts were returned: ";
print $count . PHP_EOL;
} catch (ApiException $e) {
print "An error has occured: \n";
print $e->getMessage();
}
}
public function callSample(): void
{
$config = Config::generateConfig();
self::listSubAccounts($config);
}
}
$sample = new ListSubAccounts();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import AccountsServiceClient
from google.shopping.merchant_accounts_v1 import ListSubAccountsRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
def get_parent(account_id):
return f"accounts/{account_id}"
def list_sub_accounts():
"""Lists all the subaccounts of an advanced account."""
# Get OAuth credentials.
credentials = generate_user_credentials.main()
# Create a client.
client = AccountsServiceClient(credentials=credentials)
# Get the parent advanced account ID.
parent = get_parent(_ACCOUNT)
# Create the request.
request = ListSubAccountsRequest(provider=parent)
# Make the request and print the response.
try:
print("Sending list subaccounts request:")
response = client.list_sub_accounts(request=request)
count = 0
for account in response:
print(account)
count += 1
print(f"The following count of accounts were returned: {count}")
except RuntimeError as e:
print("An error has occured: ")
print(e)
if __name__ == "__main__":
list_sub_accounts()
সিআরএল
curl -X GET \
"https://merchantapi.googleapis.com/accounts/v1/accounts/{ADVANCED_ACCOUNT_ID}:listSubaccounts" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
একটি ক্লায়েন্ট অ্যাকাউন্ট মুছুন
যদি আপনার আর কোনও ক্লায়েন্ট অ্যাকাউন্ট পরিচালনা করার প্রয়োজন না হয়, তাহলে আপনি accounts.delete পদ্ধতি ব্যবহার করে এটি মুছে ফেলতে পারেন।
এই পদ্ধতিটি কার্যকর করার জন্য মুছে ফেলা অ্যাকাউন্টটিতে প্রশাসকের অ্যাক্সেস প্রয়োজন।
এখানে একটি নমুনা অনুরোধ:
DELETE https://merchantapi.googleapis.com/accounts/v1/accounts/{SUB_ACCOUNT_ID}
যদি সফল হয়, তাহলে রেসপন্স বডিটি একটি খালি JSON অবজেক্ট হবে, যা নির্দেশ করবে যে অ্যাকাউন্টটি মুছে ফেলা হয়েছে।
নিম্নলিখিত নমুনাগুলি দেখায় যে কীভাবে একটি ক্লায়েন্ট অ্যাকাউন্ট মুছে ফেলা যায়।
জাভা
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.AccountsServiceClient;
import com.google.shopping.merchant.accounts.v1.AccountsServiceSettings;
import com.google.shopping.merchant.accounts.v1.DeleteAccountRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to delete a given Merchant Center account. */
public class DeleteAccountSample {
// This method can delete a standalone, advanced account or sub-account. If you delete an advanced
// account,
// all sub-accounts will also be deleted.
// Admin user access is required to execute this method.
public static void deleteAccount(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();
// Gets the account ID from the config file.
String accountId = config.getAccountId().toString();
// Creates account name to identify the account.
String name =
AccountName.newBuilder()
.setAccount(accountId)
.build()
.toString();
// Calls the API and catches and prints any network failures/errors.
try (AccountsServiceClient accountsServiceClient =
AccountsServiceClient.create(accountsServiceSettings)) {
DeleteAccountRequest request =
DeleteAccountRequest.newBuilder()
.setName(name)
// Optional. If set to true, the account will be deleted even if it has offers or
// provides services to other accounts. Defaults to 'false'.
.setForce(true)
.build();
System.out.println("Sending Delete Account request");
accountsServiceClient.deleteAccount(request); // No response returned on success.
System.out.println("Delete successful.");
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
deleteAccount(config);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\AccountsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\DeleteAccountRequest;
/**
* This class demonstrates how to delete a given Merchant Center account.
*/
class DeleteAccount
{
private static function getParent(string $accountId): string
{
return sprintf("accounts/%s", $accountId);
}
// This method can delete a standalone, advanced account or sub-account.
// If you delete an advanced account, all sub-accounts will also be deleted.
// Admin user access is required to execute this method.
public static function deleteAccount(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);
// Gets the account ID from the config file.
$accountId = $config['accountId'];
// Creates account name to identify the account.
$name = self::getParent($accountId);
// Calls the API and catches and prints any network failures/errors.
try {
$request = new DeleteAccountRequest([
'name' => $name,
// Optional. If set to true, the account will be deleted even if it has offers or
// provides services to other accounts. Defaults to 'false'.
'force' => true,
]);
print "Sending Delete Account request\n";
$accountsServiceClient->deleteAccount($request); // No response returned on success.
print "Delete successful.\n";
} catch (ApiException $e) {
print $e->getMessage();
}
}
public function callSample(): void
{
$config = Config::generateConfig();
self::deleteAccount($config);
}
}
$sample = new DeleteAccount();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import AccountsServiceClient
from google.shopping.merchant_accounts_v1 import DeleteAccountRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
def get_parent(account_id):
return f"accounts/{account_id}"
def delete_account():
"""Deletes a given Merchant Center account."""
# Get OAuth credentials.
credentials = generate_user_credentials.main()
# Create a client.
client = AccountsServiceClient(credentials=credentials)
# Create the account name.
name = get_parent(_ACCOUNT)
# Create the request.
request = DeleteAccountRequest(name=name, force=True)
# Make the request and print the response.
try:
print("Sending Delete Account request")
client.delete_account(request=request)
print("Delete successful.")
except RuntimeError as e:
print(e)
if __name__ == "__main__":
delete_account()
সিআরএল
curl -X DELETE \
"https://merchantapi.googleapis.com/accounts/v1/accounts/{SUB_ACCOUNT_ID}?force=true" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
পরিষেবার শর্তাবলী গ্রহণ করুন
ক্লায়েন্ট অ্যাকাউন্টগুলি মার্চেন্ট সেন্টার পরিষেবার শর্তাবলী (TOS) উত্তরাধিকারসূত্রে পায় যা প্যারেন্ট অ্যাডভান্সড অ্যাকাউন্ট স্বাক্ষর করেছে।
আপনার ব্যবসার তথ্য আপডেট করুন
আপনার ক্লায়েন্ট অ্যাকাউন্টের ব্যবসায়িক তথ্য সম্পাদনা করতে আপনি মার্চেন্ট অ্যাকাউন্টস API ব্যবহার করতে পারেন।
- কোনও অ্যাকাউন্টের ব্যবসায়িক তথ্য দেখতে,
accounts.getBusinessInfoএ কল করুন।- কোনও অ্যাকাউন্টের ব্যবসায়িক তথ্য সম্পাদনা করতে,
accounts.updateBusinessInfoকল করুন।
- কোনও অ্যাকাউন্টের ব্যবসায়িক তথ্য সম্পাদনা করতে,