คุณต้องมีบัญชี Merchant Center จึงจะใช้ Merchant API ได้ คุณใช้ UI ของ Merchant Center เพื่อสร้างได้
หากต้องการจัดการหลายบัญชี คุณสามารถสร้างบัญชีย่อยโดยใช้ Merchant API
คุณสามารถกำหนดค่าบัญชีใน UI ของ Merchant Center หรือผ่าน API ตามที่อธิบายไว้ภายหลัง
ยอมรับข้อกำหนดในการให้บริการของ Merchant Center
ผู้ขายทุกรายต้องยอมรับข้อกำหนดในการให้บริการของ Merchant Center วิธียอมรับข้อกำหนดในการให้บริการสำหรับบัญชีผู้ขายของคุณมีดังนี้
โทรไปที่
accounts.termsOfServiceAgreementStates.retrieveForApplication
เพื่อสอบถามข้อกำหนดในการให้บริการที่ต้องปฏิบัติตามสำหรับบัญชีของคุณตัวอย่างคําขอมีดังนี้
GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/termsOfServiceAgreementStates:retrieveForApplication
ตัวอย่างการตอบกลับจากการเรียกใช้ที่สำเร็จมีดังนี้
{ "name": "accounts/{ACCOUNT_ID}/termsOfServiceAgreementStates/MERCHANT_CENTER-{COUNTRY}", "regionCode": {COUNTRY}, "termsOfServiceKind": "MERCHANT_CENTER", "accepted": { "termsOfService": "termsOfService/{VERSION}", "acceptedBy": "accounts/{ACCOUNT_ID}" } }
โทรไปที่
termsOfService.accept
เพื่อยอมรับข้อกำหนดในการให้บริการตัวอย่างคําขอมีดังนี้
GET https://merchantapi.googleapis.com/accounts/v1beta/{name=termsOfService/{VERSION}}:accept
หากทำสำเร็จ เนื้อหาการตอบกลับจะว่างเปล่า
เราขอแนะนำให้สร้าง UI ที่แสดงข้อกำหนดในการให้บริการต่อผู้ขายและขอให้ผู้ขายยอมรับ
ค้นหาข้อกำหนดในการให้บริการที่ผู้ขายต้องยอมรับโดยใช้
termsOfService.retrieveLatest
กับregionCode
ของธุรกิจตัวอย่างคําขอมีดังนี้
GET https://merchantapi.googleapis.com/accounts/v1beta/termsOfService:retrieveLatest
ตัวอย่างการตอบกลับจากการเรียกใช้ที่สำเร็จมีดังนี้
{ "name": "termsOfService/{VERSION}", "regionCode": "{COUNTRY}", "kind": "MERCHANT_CENTER", "fileUri": "{URI}" }
แสดงข้อกำหนดในการให้บริการจาก
fileUri
ต่อผู้ขายเมื่อผู้ขายยอมรับข้อกำหนดในการให้บริการใน UI ให้เรียกใช้
termsOfService.accept
ด้วยname
ของข้อกำหนดในการให้บริการเพื่อยอมรับ
ต่อไปนี้คือตัวอย่างที่คุณใช้เพื่อยอมรับข้อตกลงในการให้บริการสำหรับบัญชีหนึ่งๆ ได้
Python
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1beta import AcceptTermsOfServiceRequest
from google.shopping.merchant_accounts_v1beta import TermsOfServiceServiceClient
# Replace with your actual values.
_ACCOUNT_ID = configuration.Configuration().read_merchant_info()
_TOS_VERSION = ( # Replace with the Terms of Service version to accept
"VERSION_HERE"
)
_REGION_CODE = "US" # Replace with the region code
def accept_terms_of_service():
"""Accepts the Terms of Service agreement for a given account."""
credentials = generate_user_credentials.main()
client = TermsOfServiceServiceClient(credentials=credentials)
# Construct the request
request = AcceptTermsOfServiceRequest(
name=f"termsOfService/{_TOS_VERSION}",
account=f"accounts/{_ACCOUNT_ID}",
region_code=_REGION_CODE,
)
try:
print("Sending request to accept terms of service...")
client.accept_terms_of_service(request=request)
print("Successfully accepted terms of service.")
except RuntimeError as e:
print(e)
if __name__ == "__main__":
accept_terms_of_service()
หลังจากผู้ขายยอมรับข้อกำหนดในการให้บริการแล้ว คุณจะใช้ Merchant API เพื่อตั้งค่าข้อมูลบัญชีที่เหลือได้ ดูรายละเอียดเกี่ยวกับข้อมูลบัญชีที่จัดการได้ด้วย Merchant Accounts API ได้ที่แหล่งข้อมูล Account
อ้างสิทธิ์เว็บไซต์ของคุณ
คุณสามารถใช้ Merchant Accounts API เพื่อเพิ่มและอ้างสิทธิ์Homepage
ของธุรกิจ
- หากต้องการเพิ่มหน้าแรกลงในบัญชี ให้เรียกใช้
accounts.updateHomepage
ด้วยแหล่งข้อมูลHomepage
ที่มี URL ของหน้าแรก - หากต้องการอ้างสิทธิ์การเป็นเจ้าของหน้าแรก ให้โทรไปที่
accounts.homepage.claim
พร้อมname
จากแหล่งข้อมูลHompeage
คุณใช้ Merchant API เพื่อยืนยันหน้าแรกไม่ได้ ดูข้อมูลเพิ่มเติมได้ที่ยืนยันและอ้างสิทธิ์เว็บไซต์ของร้านค้า
อัปเดตรายละเอียดธุรกิจ
คุณสามารถใช้ Merchant Accounts API เพื่อแก้ไขธุรกิจ PostalAddress
, CusomerService
และ BusinessIdentity
ข้อมูลประจำตัวของธุรกิจ
- หากต้องการดูตัวตนทางธุรกิจ ให้โทรไปที่
accounts.businessIdentity.getBusinessIdentity
- หากต้องการแก้ไขตัวตนทางธุรกิจ โปรดโทรไปที่หมายเลข
accounts.businessIdentity.updateBusinessIdentity
ขั้นตอนถัดไป
- ดูวิธีสร้างและจัดการบัญชีย่อย
- หากต้องการทำความเข้าใจความสัมพันธ์ระหว่างบัญชีผู้ขาย โปรดดูหัวข้อความสัมพันธ์ระหว่างบัญชี