Constructor

Order

new Order(orderId)

Constructor for Order.

Parameter

Name Description

orderId

string

Unique identifier for the order.

Methods

addLocation

addLocation(type, location) returns Order

Adds an associated location to the order. Up to 2 locations can be added.

Parameters

Name Description

type

string

One of TransactionValues.LocationType.

location

Location

Location to add.

Returns

Order Returns current constructed Order.

addOtherItems

addOtherItems(items) returns Order

Adds a single item or list of items to the non-cart items list.

Parameter

Name Description

items

(LineItem or Array of LineItem)

Line Items to add.

Returns

Order Returns current constructed Order.

setCart

setCart(cart) returns Order

Set the cart for this order.

Parameter

Name Description

cart

Cart

Cart for this order.

Returns

Order Returns current constructed Order.

setImage

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

Sets the image for this order.

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

Order Returns current constructed Order.

setTermsOfService

setTermsOfService(tos) returns Order

Set the TOS for this order.

Parameter

Name Description

tos

string

String URL of the TOS.

Returns

Order Returns current constructed Order.

setTime

setTime(type, time) returns Order

Sets an associated time to the order.

Parameters

Name Description

type

string

One of TransactionValues.TimeType.

time

string

Time to add. Time should be ISO 8601 representation of time value. Could be date, datetime, or duration.

Returns

Order Returns current constructed Order.

setTotalPrice

setTotalPrice(priceType, currencyCode, units, nanos) returns Order

Sets the total price for this order.

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

Order Returns current constructed Order.