Constructor

OrderUpdate

new OrderUpdate(orderId, isGoogleOrderId)

Constructor for OrderUpdate.

Parameters

Name Description

orderId

string

Unique identifier of the order.

isGoogleOrderId

boolean

True if the order ID is provided by Google. False if the order ID is app provided.

Methods

addLineItemPriceUpdate

addLineItemPriceUpdate(itemId, priceType, currencyCode, units, nanos, reason) returns OrderUpdate

Adds a single price update for a particular line item in the order.

Parameters

Name Description

itemId

string

Line item ID for the order item updated.

priceType

string

One of TransactionValues.PriceType.

currencyCode

string

Currency code of new price.

units

number

Unit count of new price.

nanos

Optional

number

Partial unit count of new price.

reason

Optional

string

Reason for the price change. Required unless a reason for this line item change was already declared in addLineItemStateUpdate.

Returns

OrderUpdate Returns current constructed OrderUpdate.

addLineItemStateUpdate

addLineItemStateUpdate(itemId, state, label, reason) returns OrderUpdate

Adds a single state update for a particular line item in the order.

Parameters

Name Description

itemId

string

Line item ID for the order item updated.

state

string

One of TransactionValues.OrderState.

label

string

Label for the new item state.

reason

Optional

string

Reason for the price change. This will overwrite any reason given in addLineitemPriceUpdate.

Returns

OrderUpdate Returns current constructed OrderUpdate.

addOrderManagementAction

addOrderManagementAction(type, label, url) returns OrderUpdate

Adds an actionable item for the user to manage the order.

Parameters

Name Description

type

string

One of TransactionValues.OrderActions.

label

string

Button label.

url

string

URL to open when button is clicked.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setActionOrderId

setActionOrderId(orderId) returns OrderUpdate

Set the Action provided order ID of the order.

Parameter

Name Description

orderId

string

Action provided order ID.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setGoogleOrderId

setGoogleOrderId(orderId) returns OrderUpdate

Set the Google provided order ID of the order.

Parameter

Name Description

orderId

string

Google provided order ID.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setInfo

setInfo(type, data) returns OrderUpdate

Sets some extra information about the order. Takes an order update info type, and any accompanying data. This should only be called once per order update.

Parameters

Name Description

type

string

One of TransactionValues.OrderStateInfo.

data

Object

Proper Object matching the data necessary for the info type. For instance, for the TransactionValues.OrderStateInfo.RECEIPT info type, use the ReceiptInfo data type.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setOrderState

setOrderState(state, label) returns OrderUpdate

Set the state of the order.

Parameters

Name Description

state

string

One of TransactionValues.OrderState.

label

string

Label for the order state.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setTotalPrice

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

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

OrderUpdate Returns current constructed OrderUpdate.

setUpdateTime

setUpdateTime(seconds, nanos) returns OrderUpdate

Set the update time of the order.

Parameters

Name Description

seconds

number

Seconds since Unix epoch.

nanos

Optional

number

Partial time units.

Returns

OrderUpdate Returns current constructed OrderUpdate.

setUserNotification

setUserNotification(title, text) returns OrderUpdate

Set the user notification content of the order update.

Parameters

Name Description

title

string

Title of the notification.

text

text

Text of the notification.

Returns

OrderUpdate Returns current constructed OrderUpdate.