GooglePayLauncher

constructor(fragment: Fragment, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from within an Android Fragment. This class must be instantiated after the Fragment's view has been created (i.e., in onCreateView or onViewCreated) and before the Fragment reaches the STARTED state.

Parameters

fragment

the Android Fragment from which you will launch the Google Pay payment sheet

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow


constructor(activity: ComponentActivity, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from within an Android Activity. This class must be instantiated before the Activity is created.

Parameters

activity

the Android Activity from which you will launch the Google Pay payment sheet

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow


constructor(registry: ActivityResultRegistry, lifecycleOwner: LifecycleOwner, context: Context, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from a composable, or anywhere else a Fragment or ComponentActivity reference is not available. This class must be instantiated before the lifecycleOwner reaches the CREATED state.

Parameters

registry

the ActivityResultRegistry to use for launching the Google Pay payment sheet

lifecycleOwner

the LifecycleOwner used to control when the launcher is registered

context

an Android Context

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow


constructor(fragment: Fragment, resultKey: String, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from within an Android Fragment, using a custom result key. This class must be instantiated after the Fragment's view has been created (i.e., in onCreateView or onViewCreated) and before the Fragment reaches the STARTED state.

Parameters

fragment

the Android Fragment from which you will launch the Google Pay payment sheet

resultKey

a unique key identifying this launcher's Activity result. Must be unique per live launcher instance in the same Activity, and stable across process death.

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow


constructor(activity: ComponentActivity, resultKey: String, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from within an Android Activity, using a custom result key. This class must be instantiated before the Activity is created.

Parameters

activity

the Android Activity from which you will launch the Google Pay payment sheet

resultKey

a unique key identifying this launcher's Activity result. Must be unique per live launcher instance in the same Activity, and stable across process death.

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow


constructor(registry: ActivityResultRegistry, lifecycleOwner: LifecycleOwner, context: Context, resultKey: String, callback: GooglePayLauncherCallback)

Used to launch the Google Pay payment sheet from a composable, or anywhere else a Fragment or ComponentActivity reference is not available, using a custom result key. This class must be instantiated before the lifecycleOwner reaches the CREATED state.

Parameters

registry

the ActivityResultRegistry to use for launching the Google Pay payment sheet

lifecycleOwner

the LifecycleOwner used to control when the launcher is registered

context

an Android Context

resultKey

a unique key identifying this launcher's Activity result. Must be unique per live launcher instance in the same Activity, and stable across process death.

callback

a GooglePayLauncherCallback to receive the result of the Google Pay payment flow