Phần hướng dẫn sau đây giải thích cách bạn nên triển khai nguồn cấp dữ liệu để phân biệt giá của một dịch vụ dựa trên nhân viên liên kết hoặc thời gian trong ngày và/hoặc ngày trong tuần.
Giá theo nhân viên/thời gian
Có 4 điều cần thiết lập:
Trong nguồn cấp dữ liệu người bán, hãy đặt một
Merchant.payment_option
cho mỗi tuỳ chọn giá- Đặt
price
mong muốn thành giá của dịch vụ cho thời gian/nhân viên cụ thể payment_option_id
phải là duy nhất trong quá trình tích hợp vì các giá trịpayment_option_id
được chia sẻ giữa tất cả người bán của cùng một trình tổng hợp. Để tránh nhầm lẫn và đơn giản hoá việc khắc phục sự cố cũng như quản lý, bạn nên (xác định lại) tất cả giá trịpayment_option
mà người bán này sử dụng bằng mộtpayment_option_id
duy nhất (ngay cả khi một người bán khác sử dụngpayment_option
giống hệt).- Đối với giá theo nhân viên, bạn nên tạo
payment_option_id
dưới dạng tổ hợp củamerchant_id
,service_id
vàstaff_id
để dễ dàng theo dõi và đảm bảopayment_option_id
là duy nhất trong toàn bộ quá trình tích hợp - Đối với giá theo thời gian, bạn nên tạo
payment_option_id
bằng cách kết hợpmerchant_id
,service_id
và một chuỗi đại diện cho thời gian này (evening
,weekends
,sundayafternoon
, v.v.) để dễ dàng theo dõi và đảm bảopayment_option_id
là duy nhất trong toàn bộ quá trình tích hợp
- Khi được dùng để định giá theo mức độ còn hàng (trường hợp sử dụng của hướng dẫn này), tên và nội dung mô tả chủ yếu được dùng cho mục đích gỡ lỗi
- Không đặt nhiều hơn 100 giá trị
payment_option
cho một người bán. Nếu bạn dự kiến sẽ đạt được hơn 100 giá trịpayment_option
, vui lòng chạy phương thức triển khai này theo hướng dẫn của người liên hệ của bạn tại Google - Bạn có thể bỏ qua tất cả các trường
payment_option
khác cho trường hợp sử dụng này
- Đối với giá theo nhân viên, bạn nên tạo
- Đặt
Trong nguồn cấp dữ liệu về tình trạng còn hàng, hãy đặt
Availability.payment_option_id
thành một mảng mục duy nhất vớipayment_option_id
củapayment_option
mà bạn đã xác định ở cấpMerchant
Trong nguồn cấp dữ liệu Dịch vụ, hãy đặt
Service.price
thành giá trị thấp nhất của phạm vi giá cho dịch vụ này và đặtService.price_interpretation
thànhSTARTS_AT
Ví dụ về giá theo nhân viên
Trong ví dụ này, Robert (mã nhận dạng: 1) là một thợ làm tóc có kinh nghiệm hơn Jane (mã nhận dạng: 2). Do đó, chủ sở hữu thẩm mỹ viện đã quyết định đặt trước cho Robert với mức giá đắt hơn 5 đô la. Theo mặc định, chi phí cắt tóc ngắn là 20 đô la và chi phí cắt tóc dài là 30 đô la. Nếu người dùng chọn Robert, thì kiểu cắt tóc sẽ có giá lần lượt là 25 USD hoặc 35 USD.
Tên nhân viên | Cắt tóc ngắn | Cắt tóc dài |
---|---|---|
Jane | 20 USD* | 30 USD* |
Robert | đô la Hong Kong | 35 USD |
*giá mặc định cho dịch vụ
Người bán
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1503638100, "total_shards": 1 }, "merchant": [ { "category": "beauty_salon", "merchant_id": "beauty-per-staff-price", "name": "Beauty Salon", "url": "www.merchantspublicsite.com", "telephone": "+1 123-456-7890", "geo": { "latitude": 37.422113, "longitude": -122.084041, "address": { "locality": "Mountain View", "country": "US", "region": "CA", "street_address": "1600 Amphitheatre Pkwy", "postal_code": "94043" } }, "payment_option": [ { "payment_option_id": "beauty-per-staff-price-haircut-short-1", "name": "Short haircut (Robert)", "description": "Short hair haircut price for Robert", "price": { "currency_code": "USD", "price_micros": 25000000 } }, { "payment_option_id": "beauty-per-staff-price-haircut-short-default", "name": "Short haircut (Default)", "description": "Normal short hair haircut price", "price": { "currency_code": "USD", "price_micros": 20000000 } }, { "payment_option_id": "beauty-per-staff-price-haircut-long-1", "name": "Long haircut (Robert)", "description": "Long hair haircut price for Robert", "price": { "currency_code": "USD", "price_micros": 35000000 } }, { "payment_option_id": "beauty-per-staff-price-haircut-long-default", "name": "Long haircut (Default)", "description": "Normal long hair haircut price", "price": { "currency_code": "USD", "price_micros": 30000000 } } ] } ] }
Dịch vụ
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1535437200, "total_shards": 1 }, "service": [ { "service_id": "haircut-short", "prepayment_type": "NOT_SUPPORTED", "merchant_id": "beauty-per-staff-price", "price": { "currency_code": "USD", "price_micros": 20000000 }, "localized_service_name": { "value": "Haircut (shorter than shoulder)", "localized_value": [ { "locale": "en", "value": "Haircut (shorter than shoulder)" } ] }, "localized_description": { "value": "Awesome haircut for short hair", "localized_value": [ { "locale": "en", "value": "Awesome haircut for short hair" } ] } }, { "service_id": "haircut-long", "prepayment_type": "NOT_SUPPORTED", "merchant_id": "beauty-per-staff-price", "price": { "currency_code": "USD", "price_micros": 30000000 }, "localized_service_name": { "value": "Haircut (longer than shoulder)", "localized_value": [ { "locale": "en", "value": "Haircut (longer than shoulder)" } ] }, "localized_description": { "value": "Awesome haircut for long hair", "localized_value": [ { "locale": "en", "value": "Awesome haircut for long hair" } ] } } ] }
Phạm vi cung cấp
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1535178900, "total_shards": 1 }, "service_availability": [ { "availability": [ { "spots_total": 1, "start_sec": 1535806800, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535846340, "repeat_every_sec": 3600 }, "service_id": "haircut-short", "merchant_id": "beauty-per-staff-price", "resources": { "staff_name": "Robert", "staff_id": "1" }, "payment_option_id": ["beauty-per-staff-price-haircut-short-1"] }, { "spots_total": 1, "start_sec": 1535806800, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535846340, "repeat_every_sec": 3600 }, "service_id": "haircut-long", "merchant_id": "beauty-per-staff-price", "resources": { "staff_name": "Robert", "staff_id": "1" }, "payment_option_id": ["beauty-per-staff-price-haircut-long-1"] }, { "spots_total": 1, "start_sec": 1535806800, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535846340, "repeat_every_sec": 3600 }, "service_id": "haircut-short", "merchant_id": "beauty-per-staff-price", "resources": { "staff_name": "Jane", "staff_id": "2" }, "payment_option_id": ["beauty-per-staff-price-haircut-short-default"] }, { "spots_total": 1, "start_sec": 1535806800, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535846340, "repeat_every_sec": 3600 }, "service_id": "haircut-long", "merchant_id": "beauty-per-staff-price", "resources": { "staff_name": "Jane", "staff_id": "2" }, "payment_option_id": ["beauty-per-staff-price-haircut-long-default"] } ] } ] }
Ví dụ về giá theo thời gian
Trong ví dụ này, thẩm mỹ viện mở cửa từ 10:00 đến 20:00. Chủ sở hữu thẩm mỹ viện quyết định tính thêm 5 USD cho các lượt đặt lịch sau 18:00.
Ví dụ về tình trạng còn hàng được xác định cho ngày thứ Bảy, ngày 1 tháng 9 năm 2018 theo múi giờ Thái Bình Dương. 1535821200 là 10:00 vào ngày đó, 1535850000 là 18:00 vào ngày đó và 1535857200 là 20:00.
Thời điểm trong ngày | Cắt tóc ngắn | Cắt tóc dài |
---|---|---|
10:00 – 11:00 | 20 USD | 30 USD |
11:00 ~ 12:00 | 20 USD | 30 USD |
12:00 – 13:00 | 20 USD | 30 USD |
13:00 ~ 14:00 | 20 USD | 30 USD |
14:00 ~ 15:00 | 20 USD | 30 USD |
15:00 ~ 16:00 | 20 USD | 30 USD |
16:00 ~ 17:00 | 20 USD | 30 USD |
17:00 ~ 18:00 | 20 USD | 30 USD |
18:00 ~ 19:00 | đô la Hong Kong | 35 USD |
19:00 ~ 20:00 | đô la Hong Kong | 35 USD |
Người bán
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1503638100, "total_shards": 1 }, "merchant": [ { "category": "beauty_salon", "merchant_id": "beauty-per-time-price", "name": "Beauty Salon", "url": "www.merchantspublicsite.com", "telephone": "+1 123-456-7890", "geo": { "latitude": 37.422113, "longitude": -122.084041, "address": { "locality": "Mountain View", "country": "US", "region": "CA", "street_address": "1600 Amphitheatre Pkwy", "postal_code": "94043" } }, "payment_option": [ { "payment_option_id": "beauty-per-time-price-haircut-short-evening", "name": "Short haircut (Evening)", "description": "Short hair haircut price for the evening", "price": { "currency_code": "USD", "price_micros": 25000000 } }, { "payment_option_id": "beauty-per-time-price-haircut-short-default", "name": "Short haircut (Normal)", "description": "Short hair haircut price for the rest of the day", "price": { "currency_code": "USD", "price_micros": 21000000 } }, { "payment_option_id": "beauty-per-time-price-haircut-long-evening", "name": "Long haircut (Evening)", "description": "Long hair haircut price for the evening", "price": { "currency_code": "USD", "price_micros": 35000000 } }, { "payment_option_id": "beauty-per-time-price-haircut-long-default", "name": "Long haircut (Normal)", "description": "Long hair haircut price for the rest of the day", "price": { "currency_code": "USD", "price_micros": 31000000 } } ] } ] }
Dịch vụ
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1535437200, "total_shards": 1 }, "service": [ { "service_id": "haircut-short", "prepayment_type": "NOT_SUPPORTED", "merchant_id": "beauty-per-time-price", "price": { "currency_code": "USD", "price_micros": 2100000 }, "localized_service_name": { "value": "Haircut (shorter than shoulder)", "localized_value": [ { "locale": "en", "value": "Haircut (shorter than shoulder)" } ] }, "localized_description": { "value": "Awesome haircut for short hair", "localized_value": [ { "locale": "en", "value": "Awesome haircut for short hair" } ] } }, { "service_id": "haircut-long", "prepayment_type": "NOT_SUPPORTED", "merchant_id": "beauty-per-time-price", "price": { "currency_code": "USD", "price_micros": 31000000 }, "localized_service_name": { "value": "Haircut (longer than shoulder)", "localized_value": [ { "locale": "en", "value": "Haircut (longer than shoulder)" } ] }, "localized_description": { "value": "Awesome haircut for long hair", "localized_value": [ { "locale": "en", "value": "Awesome haircut for long hair" } ] } } ] }
Phạm vi cung cấp
{ "metadata": { "processing_instruction": "PROCESS_AS_COMPLETE", "generation_timestamp": 1535178900, "total_shards": 1 }, "service_availability": [ { "availability": [ { "spots_total": 1, "start_sec": 1535821200, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535849940, "repeat_every_sec": 3600 }, "service_id": "haircut-short", "merchant_id": "beauty-per-time-price", "payment_option_id": ["beauty-per-time-price-haircut-short-default"] }, { "spots_total": 1, "start_sec": 1535821200, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535849940, "repeat_every_sec": 3600 }, "service_id": "haircut-long", "merchant_id": "beauty-per-time-price", "payment_option_id": ["beauty-per-time-price-haircut-long-default"] }, { "spots_total": 1, "start_sec": 1535850000, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535857140, "repeat_every_sec": 3600 }, "service_id": "haircut-short", "merchant_id": "beauty-per-time-price", "payment_option_id": ["beauty-per-time-price-haircut-short-evening"] }, { "spots_total": 1, "start_sec": 1535850000, "spots_open": 1, "duration_sec": 3600, "recurrence": { "repeat_until_sec": 1535857140, "repeat_every_sec": 3600 }, "service_id": "haircut-long", "merchant_id": "beauty-per-time-price", "payment_option_id": ["beauty-per-time-price-haircut-long-evening"] } ] } ] }