Constructor

LineItem

new LineItem(lineItemId, name)

Constructor for LineItem.

Parameters

Name Description

lineItemId

string

Unique identifier for the item.

name

string

Name of the item.

Methods

addSublines

addSublines(items) returns LineItem

Adds a single item or list of items or notes to the sublines. Only valid if item type is REGULAR.

Parameter

Name Description

items

(string, LineItem, or Array of (string or LineItem))

Sublines to add.

Returns

LineItem Returns current constructed LineItem.

setDescription

setDescription(description) returns LineItem

Set the description of the item.

Parameter

Name Description

description

string

Description of the item.

Returns

LineItem Returns current constructed LineItem.

setImage

setImage(url, accessibilityText, width, height) returns LineItem

Sets the image for this item.

Parameters

Name Description

url

string

Image source URL.

accessibilityText

string

Text to replace for image for accessibility.

width

Optional

number

Width of the image.

height

Optional

number

Height of the image.

Returns

LineItem Returns current constructed LineItem.

setOfferId

setOfferId(offerId) returns LineItem

Set the Offer ID of the item.

Parameter

Name Description

offerId

string

Offer ID of the item.

Returns

LineItem Returns current constructed LineItem.

setPrice

setPrice(priceType, currencyCode, units, nanos) returns LineItem

Sets the price of this item.

Parameters

Name Description

priceType

string

One of TransactionValues.PriceType.

currencyCode

string

Currency code of price.

units

number

Unit count of price.

nanos

Optional

number

Partial unit count of price.

Returns

LineItem Returns current constructed LineItem.

setQuantity

setQuantity(quantity) returns LineItem

Set the quantity of the item.

Parameter

Name Description

quantity

number

Quantity of the item.

Returns

LineItem Returns current constructed LineItem.

setType

setType(type) returns LineItem

Set the type of the item.

Parameter

Name Description

type

string

Type of the item. One of TransactionValues.ItemType.

Returns

LineItem Returns current constructed LineItem.