Builder for
PriceItem objects.
Example usage:
// Create a price item builder.
var priceItemBuilder = AdsApp.extensions().newPriceItemBuilder();
// Create a price item operation.
var priceItemOperation = priceItemBuilder
.withHeader("Kid's Haircut") // required
.withDescription("Girls and boys") // required
.withAmount(10) // required
.withCurrencyCode("USD") // required
.withUnitType("PER_WEEK") // required
.withFinalUrl("http://www.example.com/") // required
.build();
// Optional: examine the outcome. The call to isSuccessful()
// will block until the operation completes.
if (priceItemOperation.isSuccessful()) {
// Get the result.
var priceItem = priceItemOperation.getResult();
} else {
// Handle the errors.
var errors = priceItemOperation.getErrors();
}
Methods:
build()
Creates a
PriceItem. Returns a PriceItemOperation that can be used to get the new price
item (or access any associated errors if creation failed).
Return values:
withAmount(amount)
Sets the amount of money of the new price item to the specified value. Required
before building.
Arguments:
Name | Type | Description |
amount |
long |
Price item amount of money in micros. |
Return values:
withCurrencyCode(code)
Sets the currency code of the new price item to the specified value. Required before building.
See
the API reference
for currency codes.
Arguments:
Name | Type | Description |
code |
String |
Price item currency code. |
Return values:
withDescription(description)
Sets the description text of the new price item to the specified value. Required before
building.
Arguments:
Name | Type | Description |
description |
String |
Price item description text. |
Return values:
withFinalUrl(finalUrl)
Sets the final URL of the new price item to the specified value.
The final URL represents the actual landing page for your price item. The
final URL must be the URL of the page that the user ends up on after clicking on your ad, once
all the redirects have taken place.
See Using Upgraded URLs for
more information.
Arguments:
Name | Type | Description |
finalUrl |
String |
The final URL for the price item. |
Return values:
Sets the header text of the new price item to the specified value. Required before building.
Arguments:
Name | Type | Description |
header |
String |
Price item header text. |
Return values:
withMobileFinalUrl(mobileFinalUrl)
Sets the mobile final URL of the new price item to the specified value.
The mobile final URL represents the actual landing page for your price item on
a mobile device. The final mobile URL must be the URL of the page that the user ends up on
after clicking on your ad on a mobile device, once all the redirects have taken place.
See Using Upgraded URLs for
more information.
Arguments:
Name | Type | Description |
mobileFinalUrl |
String |
The mobile final URL for the price item. |
Return values:
withUnitType(unitType)
Sets the unit type of the new price item to the specified value. Required before building. The
unit type defines the rate that describes the price and must be one of
['PER_HOUR',
'PER_DAY', 'PER_WEEK', 'PER_MONTH', 'PER_YEAR', 'PER_NIGHT', 'NONE']
.
Arguments:
Name | Type | Description |
unitType |
String |
Price item unit type. |
Return values: