present

open override fun present(amount: Long)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception


open override fun present(amount: Long, checkoutStatus: CheckoutStatus?)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

checkoutStatus

The status for the transaction. This will affect how the confirmation button in the Google Pay sheet is displayed.

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception


open override fun present(amount: Long, checkoutStatus: CheckoutStatus?, totalPriceLabel: String?)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

checkoutStatus

The status for the transaction. This will affect how the confirmation button in the Google Pay sheet is displayed.

totalPriceLabel

A custom label to override the default total price label set by Google

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception


open override fun present(amount: Long, checkoutStatus: CheckoutStatus?, totalPriceLabel: String?, lineItems: List<LineItem>?)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

checkoutStatus

The status for the transaction. This will affect how the confirmation button in the Google Pay sheet is displayed.

totalPriceLabel

A custom label to override the default total price label set by Google

lineItems

A list of items to display in the Google Pay sheet.

Important: The sum total of the line items will be compared to the amount parameter. If they do not match, a GooglePayException will be thrown. If this validation is not desired, use a present method that takes the validateLineItems parameter.

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception


open override fun present(amount: Long, checkoutStatus: CheckoutStatus?, totalPriceLabel: String?, lineItems: List<LineItem>?, validateLineItems: Boolean)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

checkoutStatus

The status for the transaction. This will affect how the confirmation button in the Google Pay sheet is displayed.

totalPriceLabel

A custom label to override the default total price label set by Google

lineItems

A list of items to display in the Google Pay sheet.

validateLineItems

If true, a GooglePayException will be thrown if the sum of the line items does not equal the total amount passed in.

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception


open override fun present(amount: Long, checkoutStatus: CheckoutStatus?, totalPriceLabel: String?, lineItems: List<LineItem>?, validateLineItems: Boolean, transactionId: String?)

Presents the Google Pay sheet. Use resultCallback to listen for and handle the result of showing the Google Pay sheet to the user.

Parameters

amount

The amount intended to be collected. It should be a positive long representing how much to charge in the smallest currency unit (e.g. 100 cents to charge $1.00).

checkoutStatus

The status for the transaction. This will affect how the confirmation button in the Google Pay sheet is displayed.

totalPriceLabel

A custom label to override the default total price label set by Google

lineItems

A list of items to display in the Google Pay sheet.

validateLineItems

If true, a GooglePayException will be thrown if the sum of the line items does not equal the total amount passed in.

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 sending callbacks to the Google Transaction Events API

Throws

Thrown if Google Pay isn't ready or if the configuration is not valid. Refer to ErrorType for the specific conditions that cause this method to throw an exception