W tym samouczku wyjaśniamy, jak implementować pliki danych, aby zróżnicować ceny usług na podstawie powiązanego pracownika lub godziny lub dnia tygodnia.
Cena za pracownika/czas
Należy ustawić 4 parametry:
W pliku danych Merchant ustaw jedną wartość
Merchant.payment_option
dla każdej opcji ceny.- Ustaw
price
na cenę usługi za określony czas/personel. payment_option_id
musi być niepowtarzalna w ramach integracji, ponieważ wartościpayment_option_id
są udostępniane wszystkim sprzedawcom w ramach tego samego agregatora. Aby uniknąć nieporozumień oraz uprościć rozwiązywanie problemów i zarządzanie, zalecamy, aby dla każdego sprzedawcy (ponownie) zdefiniować wszystkie wartościpayment_option
, których używa ten sprzedawca, za pomocą unikalnego parametrupayment_option_id
(nawet jeśli identyczny parametrpayment_option
jest używany przez innego sprzedawcę).- W przypadku ceny za pracownika zalecamy wygenerowanie wartości
payment_option_id
jako kombinacji wartościmerchant_id
,service_id
istaff_id
, aby ułatwić śledzenie i zapewnić, że wartośćpayment_option_id
będzie unikalna w całej integracji. - W przypadku ceny za czas zalecamy wygenerowanie parametru
payment_option_id
jako kombinacji parametrówmerchant_id
,service_id
i ciągu znaków reprezentującego czas (evening
,weekends
,sundayafternoon
itd.). Ułatwi to śledzenie i zapewni, że parametrpayment_option_id
będzie unikalny w całej integracji.
- W przypadku cen na podstawie dostępności (taki scenariusz jest omawiany w tym samouczku) nazwa i opis są używane głównie do debugowania.
- Nie ustawiaj więcej niż 100 wartości
payment_option
dla jednego sprzedawcy. Jeśli spodziewasz się, że uzyskasz więcej niż 100 wartościpayment_option
, poproś o pomoc w tej implementacji swojego przedstawiciela Google. - W tym przypadku można zignorować wszystkie pozostałe pola
payment_option
- W przypadku ceny za pracownika zalecamy wygenerowanie wartości
- Ustaw
W pliku danych z dostępnością ustaw
Availability.payment_option_id
jako tablicę pojedynczych elementów zpayment_option_id
elementupayment_option
zdefiniowanego na poziomieMerchant
.W pliku danych usługi ustaw
Service.price
na najniższą wartość w zakresie cen dla tej usługi, aService.price_interpretation
naSTARTS_AT
.
Przykład ceny za pracownika
W tym przykładzie Robert (identyfikator: 1) jest bardziej doświadczonym fryzjerem niż Jane (identyfikator: 2), dlatego właściciel salonu zdecydował się na rezerwację dla Roberta o 5 USD droższą. Koszt usługi fryzjerskiej dla krótkich włosów wynosi domyślnie 20 USD, a dla długich włosów – 30 USD. Jeśli użytkownik wybierze Roberta, koszt fryzury wyniesie odpowiednio 25 lub 35 zł.
Imię i nazwisko | Krótkie włosy | Strzyżenie długich włosów |
---|---|---|
Jane | 20 USD* | 30 USD* |
Robert | 25 HKD | 35 USD |
*domyślna cena usługi
Sprzedawcy
{ "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 } } ] } ] }
Usługi
{ "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" } ] } } ] }
Dostępność
{ "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"] } ] } ] }
Przykład ceny za czas
W tym przykładzie salon jest otwarty od 10:00 do 20:00. Właściciel salonu zdecydował się na dodanie dodatkowej opłaty w wysokości 5 USD za rezerwacje po godzinie 18:00.
Przykład dostępności jest zdefiniowany na sobotę 1 września 2018 r. w strefie czasowej PT. 1535821200 to 10:00, 1535850000 to 18:00, a 1535857200 to 20:00.
Pora dnia | Krótkie włosy | Strzyżenie długich włosów |
---|---|---|
10:00–11:00 | 20 HKD | 30 HKD |
11:00–12:00 | 20 HKD | 30 HKD |
12:00–13:00 | 20 HKD | 30 HKD |
13:00–14:00 | 20 HKD | 30 HKD |
14:00–15:00 | 20 HKD | 30 HKD |
15:00–16:00 | 20 HKD | 30 HKD |
16:00–17:00 | 20 HKD | 30 HKD |
17:00–18:00 | 20 HKD | 30 HKD |
18:00–19:00 | 25 HKD | 35 USD |
19:00–20:00 | 25 HKD | 35 USD |
Sprzedawcy
{ "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 } } ] } ] }
Usługi
{ "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" } ] } } ] }
Dostępność
{ "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"] } ] } ] }