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á cho một dịch vụ dựa trên nhân viên liên quan 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 mục bạn 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 lựa chọn về giá- Đặt
price
mong muốn thành giá 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ì giá trịpayment_option_id
được dùng chung cho tất cả người bán thuộc cùng một đơn vị tổng hợp. Để tránh nhầm lẫn cũng như đơn giản hoá việc khắc phục sự cố và quản lý, bạn nên (lại) xác định tất cả cá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ộtpayment_option
giống hệt được sử dụng bởi một người bán khác).- Đối với giá của mỗi nhân viên, bạn nên tạo
payment_option_id
kết hợp giữamerchant_id
,service_id
vàstaff_id
để dễ dàng theo dõi hơn và đảm bảopayment_option_id
là duy nhất trên 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
kết hợp giữamerchant_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 hơn và đảm bảopayment_option_id
là duy nhất trong toàn bộ quá trình tích hợp
- Khi dùng cho mức giá ở cấp tình trạng 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 quá 100 giá trị
payment_option
cho một người bán. Nếu bạn dự kiến đạt được hơn 100 giá trịpayment_option
, vui lòng chạy việc triển khai này cho người liên hệ của Google - Bạn có thể bỏ qua tất cả các trường
payment_option
khác đối với trường hợp sử dụng này
- Đối với giá của mỗi nhân viên, bạn nên tạo
- Đặt
Trong nguồn cấp dữ liệu Tình trạng còn hàng, hãy đặt
Availability.payment_option_id
thành mảng mặt hàng 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 trong khoảng 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ó nhiều kinh nghiệm hơn Jane (mã nhận dạng: 2) nên chủ sở hữu tiệm đã quyết định đặt trước cho Robert 5 USD đắt hơn. Theo mặc định, chi phí cho một lần cắt tóc ngắn là 20 đô la Mỹ và chi phí cho một lần cắt tóc dài là 30 đô la Mỹ. Nếu người dùng chọn Robert, lần cắt 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* | $30* |
Robert | đô la Hong Kong | $35 |
*giá dịch vụ mặc định
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 áp dụng
{ "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, tiệm mở cửa từ 10:00 đến 20:00. Chủ tiệm quyết định thêm 5 đô la Mỹ cho những trường hợp đặt chỗ sau 18:00.
Ví dụ về tình trạng sẵn có được xác định cho thứ Bảy, ngày 1 tháng 9 năm 2018 theo múi giờ PT. 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 | $30 |
11:00 ~ 12:00 | $20 | $30 |
12:00 ~ 13:00 | $20 | $30 |
13:00 ~ 14:00 | $20 | $30 |
14:00 ~ 15:00 | $20 | $30 |
15:00 ~ 16:00 | $20 | $30 |
16:00 ~ 17:00 | $20 | $30 |
17:00 ~ 18:00 | $20 | $30 |
18:00 đến 19:00 | đô la Hong Kong | $35 |
19:00 đến 20:00 | đô la Hong Kong | $35 |
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 áp dụng
{ "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"] } ] } ] }