Adds a price item to the price. The minimum number of items allowed is 3
and the maximum number is 8. Before calling build() the price
should contain the right amount of price items.
Creates a Price.
Returns a PriceOperation
that can be used to get the new price (or access any
associated errors if creation failed).
Defaults to building the type of price that is currently
serving. If there are upgraded prices, then an upgraded
price will be built by default. If there are only legacy
prices, then a legacy price will be built
by default. If there are neither, then an upgraded price will
be built by default.
Arguments:
Name
Type
Description
buildLegacy
boolean
If true, builds a legacy price. If false, builds an upgraded price. If
unspecified, defaults to building whichever type is currently serving.
Sets the price's end date from either an object containing
year, month, and day fields, or an 8-digit string in YYYYMMDD
format. This field is optional.
For instance, priceBuilder.withEndDate("20130503"); is equivalent to priceBuilder.withEndDate({year: 2013, month: 5, day: 3});.
The change will fail and report an error if:
the given date is invalid (e.g.,
{year: 2013, month: 5, day: 55}),
Sets the price's device preference to mobile or clears it.
This field is optional and defaults to false.
Arguments:
Name
Type
Description
isMobilePreferred
boolean
Whether or not this price should be
mobile preferred. If true is passed in, device preference
will be set to mobile. If false is passed in, device
preference will be set to none.
Sets the price type of the price. This field is required and must be one of
['BRANDS', 'EVENTS', 'LOCATIONS', 'NEIGHBORHOODS',
'PRODUCT_CATEGORIES', 'PRODUCT_TIERS', 'SERVICES', 'SERVICE_CATEGORIES',
'SERVICE_TIERS']
Sets the price scheduling. Scheduling of a price allows you to control the days of week and times of day during which
the price will show alongside your ads.
Passing in an empty array clears the scheduling field, causing the price to run at all times.
The following example sets the price to run on Mondays and
Tuesday from 8:00 to 11:00.
Sets the price's start date from either an object containing
year, month, and day fields, or an 8-digit string in YYYYMMDD
format. This field is optional.
For instance, priceBuilder.withStartDate("20130503"); is equivalent to priceBuilder.withStartDate({year: 2013, month: 5, day: 3});.
The change will fail and report an error if:
the given date is invalid (e.g.,
{year: 2013, month: 5, day: 55}),
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-23 UTC."],[],[]]