Creating a PaymentsClient instance

Create an instance of PaymentsClient in the onCreate method of your Activity to allow interaction with the PaymentsClient API.

private fun initPaymentsClient(activity: Activity, mode: String): PaymentsClient {
	val builder = Wallet.WalletOptions.Builder()
	if (mode == "TEST") {             
		builder.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
	} else {             
		builder.setEnvironment(WalletConstants.ENVIRONMENT_PRODUCTION)
	}
	return Wallet.getPaymentsClient(activity, builder.build())
}

During the integration phase, if you are using the sample code, the PAYMENT_MODE variable must be set to TEST in the MainActivity.kt file.