present

fun present(currencyCode: String, amount: Long = 0, transactionId: String? = null, label: String? = null)

Present the Google Pay UI.

An IllegalStateException will be thrown if Google Pay is not available or ready for usage.

Parameters

currencyCode

ISO 4217 alphabetic currency code. (e.g. "USD", "EUR")

amount

Amount intended to be collected. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). If the amount is not yet known, use 0.

transactionId

A unique ID that identifies a transaction attempt. Merchants may use an existing ID or generate a specific one for Google Pay transaction attempts. This field is required when you send callbacks to the Google Transaction Events API.

label

An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided.


fun present(currencyCode: String, amount: Int, transactionId: String? = null)

Deprecated

Use the present method that takes a Long as the amount instead.

Replace with

present(currencyCode, amount.toLong(), transactionId)

Present the Google Pay UI.

An IllegalStateException will be thrown if Google Pay is not available or ready for usage.

Parameters

currencyCode

ISO 4217 alphabetic currency code. (e.g. "USD", "EUR")

amount

Amount intended to be collected. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). If the amount is not yet known, use 0.

transactionId

A unique ID that identifies a transaction attempt. Merchants may use an existing ID or generate a specific one for Google Pay transaction attempts. This field is required when you send callbacks to the Google Transaction Events API.