ویژگی پرداخت، با اجازه دادن به مشتریانی که آماده خرید هستند تا مستقیماً از لیست محصولات گوگل به سبد خرید یا صفحه پرداخت وبسایت شما بروند، سرعت خرید را برای آنها افزایش میدهد که میتواند نرخ تبدیل را بهبود بخشد و تجربه خرید را روانتر کند.
With Merchant API, you can manage the settings for this feature using the CheckoutSettings resource.
This guide explains how to use Merchant API to create and manage your enrollment in the checkout feature programmatically.
For more information, see Add a checkout link for your products .
پیشنیازها
To use the CheckoutSettings resource and associated methods, make sure to do the following:
- You must be approved for and participating in Shopping Ads, free listings, or both.
- کشور فروش شما باید ایالات متحده باشد.
روشها
To create, retrieve, update, and delete checkout settings, you can use the following methods:
ایجاد تنظیمات پرداخت
برای ایجاد تنظیمات پرداخت، از متد checkoutSettings.create استفاده کنید. uri_settings به همراه checkout_uri_template یا cart_uri_template و همچنین eligible_destinations انتخاب شده در بدنه درخواست، وارد کنید.
در اینجا یک نمونه درخواست آمده است:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings
{
"uri_settings": {
"checkout_uri_template": "https://www.your-store.com/checkout?item_id={id}"
},
"eligible_destinations": [
"FREE_LISTINGS",
"SHOPPING_ADS"
]
}
Replace {ACCOUNT_ID} with the unique identifier of your Merchant Center account.
در اینجا نمونهای از پاسخ یک تماس موفق را مشاهده میکنید:
{
"name": "accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings",
"uri_settings": {
"checkout_uri_template": "https://www.your-store.com/checkout?item_id={id}"
},
"eligible_destinations": [
"FREE_LISTINGS",
"SHOPPING_ADS"
],
"enrollment_state": "ENROLLED",
"review_state": "IN_REVIEW",
"effective_uri_settings": {
"checkout_uri_template": "https://www.your-store.com/checkout?item_id={id}"
},
"effective_enrollment_state": "ENROLLED",
"effective_review_state": "IN_REVIEW"
}
تنظیمات پرداخت را بازیابی کنید
To retrieve your checkout settings, including the URL template, selected destinations, enrollment status, and URL review status, use the checkoutSettings.get method.
در اینجا یک نمونه درخواست آمده است:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings
در اینجا نمونهای از پاسخ یک تماس موفق را مشاهده میکنید:
{
"name": "accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings",
"uri_settings": {
"checkout_uri_template": "https://www.your-store.com/checkout?item_id={id}"
},
"eligible_destinations": [
"FREE_LISTINGS",
"SHOPPING_ADS"
],
"enrollment_state": "ENROLLED",
"review_state": "APPROVED",
"effective_uri_settings": {
"checkout_uri_template": "https://www.your-store.com/checkout?item_id={id}"
},
"effective_enrollment_state": "ENROLLED",
"effective_review_state": "APPROVED"
}
تنظیمات پرداخت را بهروزرسانی کنید
To update your checkout settings, use the checkoutSettings.update method. Include the fields you want to change in the request body and specify those fields in the update_mask query parameter.
update_mask از فیلدهای زیر پشتیبانی میکند:
-
eligible_destinations -
uri_settings
Here's a sample request updating the URL and removing the ads destination:
PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings?update_mask=uri_settings,eligible_destinations
{
"uri_settings": {
"cart_uri_template": "https://shop.your-store.com/add_to_cart?sku={id}"
},
"eligible_destinations": [
"FREE_LISTINGS"
]
}
در اینجا نمونهای از پاسخ یک تماس موفق را مشاهده میکنید:
{
"name": "accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings",
"uri_settings": {
"cart_uri_template": "https://shop.your-store.com/add_to_cart?sku={id}"
},
"eligible_destinations": [
"FREE_LISTINGS"
],
"enrollment_state": "ENROLLED",
"review_state": "IN_REVIEW", // Review state will always be set to "IN_REVIEW" after URL update
"effective_uri_settings": {
"cart_uri_template": "https://shop.your-store.com/add_to_cart?sku={id}"
},
"effective_enrollment_state": "ENROLLED",
"effective_review_state": "IN_REVIEW"
}
حذف
To delete the checkout settings, use the checkoutSettings.delete method.
This action removes your account-level configuration, un-enrolls you from the checkout program, and stops checkout links from appearing on your products in free listings and Shopping ads.
در اینجا یک نمونه درخواست آمده است:
DELETE https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/checkout/checkoutSettings
A successful call returns an empty response body.
Account-level versus product-level checkout links
You have two ways to provide checkout URLs for your products:
سطح حساب (زیر-API یا مرکز فروشندگان): برای تعریف یک الگوی URL واحد، چه
checkout_uri_templateو چهcart_uri_template، میتوانید از تنظیمات زیر-API یا مرکز فروشندگان استفاده کنید. این الگو برای همه محصولات واجد شرایط شما اعمال میشود. توصیه میکنیم که یک URL ثابت برای همه محصولات خود داشته باشید. به عنوان مثال،yourstore.com/checkout?id={id}.سطح محصول (فید): برای ارائه یک URL پرداخت خاص برای محصولات خاص، از ویژگی
checkout_link_templateدر فید محصول خود استفاده کنید. این امکان را برای URL های سفارشی برای هر محصول فراهم می کند یا به شما امکان می دهد فقط برای زیرمجموعه ای از موجودی خود، پرداخت را ارائه دهید.If you set an account-level URL template using this sub-API, make sure that you don't submit values for the
checkout_link_templateattribute in your feed for those products.اگر از ویژگی فید
checkout_link_templateاستفاده میکنید، مطمئن شوید که الگوی URL سطح حساب را با استفاده از تنظیمات sub-API یا مرکز فروشندگان تنظیم نمیکنید. اگر URLها را صرفاً از طریق فید مدیریت میکنید، همچنان میتوانید از sub-API برای انتخابeligible_destinationsبدون ارائهuri_settingsاستفاده کنید.
الگوی آدرس اینترنتی پرداخت
الگوی آدرس اینترنتی پرداخت به شما امکان میدهد یک آدرس اینترنتی پرداخت را در دادههای محصول خود وارد کنید که به خریداران آنلاین این امکان را میدهد که مستقیماً از فهرستهای شما به صفحه پرداخت شما بروند. این آدرس باید حاوی پارامتر {ID} و یک دامنه منطبق باشد.
When you set up checkout links using the sub-API, use the uri_settings field. This field accepts one of two templates:
-
checkout_uri_template: A URL template that, when the placeholder is filled, directs the user to your checkout page with the specific item ready for purchase. -
cart_uri_template: A URL template that directs the user to your shopping cart page with the specific item added to the cart.
الگوهای نمونه
- Checkout:
https://www.your-store.com/checkout?item_id={id} - Cart:
https://shop.your-store.com/add_to_cart?product_sku={id}
مطمئن شوید که شرایط زیر را رعایت میکنید:
- Your URL template must point to a valid page on your site that matches your registered domain, works using the
HTTP GETmethod, and doesn't require the customer to sign in. - The domain from the provided checkout template must match the product domain.