Constructor

LineItem

new LineItem(lineItemId, name)

Constructor for LineItem.

Parameter

lineItemId

string

Unique identifier for the item.

name

string

Name of the item.

Properties

description

string

Description for the item.

id

string

Item ID.

image

Image

Image of the item.

name

string

Name of the item.

offerId

string

Offer ID for the item.

price

Price

Item price.

quantity

number

Quantity of the item.

subLines

Array of (string or LineItem)

Sublines for current item. Only valid if item type is REGULAR.

type

string

Type of the item. One of TransactionValues.LineItemType.

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

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

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.

Parameter

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

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.

Parameter

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

quantity

number

Quantity of the item.

Returns

LineItem Returns current constructed LineItem.

setType

setType(type) returns LineItem

Set the type of the item.

Parameter

type

string

Type of the item. One of TransactionValues.LineItemType.

Returns

LineItem Returns current constructed LineItem.