สร้างและตั้งค่าบัญชีผู้ขาย

คุณต้องมีบัญชี Merchant Center จึงจะใช้ Merchant API ได้ คุณใช้ UI ของ Merchant Center เพื่อสร้างได้

หากต้องการจัดการหลายบัญชี คุณสามารถสร้างบัญชีย่อยโดยใช้ Merchant API

คุณสามารถกำหนดค่าบัญชีใน UI ของ Merchant Center หรือผ่าน API ตามที่อธิบายไว้ภายหลัง

ยอมรับข้อกำหนดในการให้บริการของ Merchant Center

ผู้ขายทุกรายต้องยอมรับข้อกำหนดในการให้บริการของ Merchant Center วิธียอมรับข้อกำหนดในการให้บริการสำหรับบัญชีผู้ขายของคุณมีดังนี้

  1. โทรไปที่ 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}"
        }
    }
    
  2. โทรไปที่ termsOfService.accept เพื่อยอมรับข้อกำหนดในการให้บริการ

    ตัวอย่างคําขอมีดังนี้

    GET https://merchantapi.googleapis.com/accounts/v1beta/{name=termsOfService/{VERSION}}:accept
    

    หากทำสำเร็จ เนื้อหาการตอบกลับจะว่างเปล่า

เราขอแนะนำให้สร้าง UI ที่แสดงข้อกำหนดในการให้บริการต่อผู้ขายและขอให้ผู้ขายยอมรับ

  1. ค้นหาข้อกำหนดในการให้บริการที่ผู้ขายต้องยอมรับโดยใช้ termsOfService.retrieveLatest กับ regionCode ของธุรกิจ

    ตัวอย่างคําขอมีดังนี้

    GET https://merchantapi.googleapis.com/accounts/v1beta/termsOfService:retrieveLatest
    

    ตัวอย่างการตอบกลับจากการเรียกใช้ที่สำเร็จมีดังนี้

    {
        "name": "termsOfService/{VERSION}",
        "regionCode": "{COUNTRY}",
        "kind": "MERCHANT_CENTER",
        "fileUri": "{URI}"
    }
    
  2. แสดงข้อกำหนดในการให้บริการจาก fileUri ต่อผู้ขาย

  3. เมื่อผู้ขายยอมรับข้อกำหนดในการให้บริการใน 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 ของธุรกิจ

  1. หากต้องการเพิ่มหน้าแรกลงในบัญชี ให้เรียกใช้ accounts.updateHomepage ด้วยแหล่งข้อมูล Homepage ที่มี URL ของหน้าแรก
  2. หากต้องการอ้างสิทธิ์การเป็นเจ้าของหน้าแรก ให้โทรไปที่ accounts.homepage.claim พร้อมnameจากแหล่งข้อมูล Hompeage

คุณใช้ Merchant API เพื่อยืนยันหน้าแรกไม่ได้ ดูข้อมูลเพิ่มเติมได้ที่ยืนยันและอ้างสิทธิ์เว็บไซต์ของร้านค้า

อัปเดตรายละเอียดธุรกิจ

คุณสามารถใช้ Merchant Accounts API เพื่อแก้ไขธุรกิจ PostalAddress, CusomerService และ BusinessIdentity

ข้อมูลประจำตัวของธุรกิจ

ขั้นตอนถัดไป