#aliumujib_unexpected

1 messages ยท Page 1 of 1 (latest)

south locustBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1227242744842551371

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

hoary jackalBOT
hexed turtle
#

Hi there ๐Ÿ‘‹ to confirm, you saw the same error when you were using the suggested GooglePayLauncher?

dusky mural
#

Hello

#

yes I did

hexed turtle
#

Can you share what you did up to that point? What code was running when the app crashed while using GooglePayLauncher?

dusky mural
#

OK sure

#

I added the following to the Manifest:

<application>
  ...
  <meta-data
    android:name="com.google.android.gms.wallet.api.enabled"
    android:value="true" />
</application>```
#

when the app is initialized, I call ``` PaymentConfiguration.init(this, PUBLISHABLE_KEY)

#

Following that, I initialize the customer sheet, this is to collect normal card inforamtion and it works already. The setup for the customer adapter is as follows:

            context = applicationContext,
            customerEphemeralKeyProvider = paymentKeyProvider,
            setupIntentClientSecretProvider = clientSecretProvider
        )
        _customerAdapter = Optional.of(
            PaymentCustomerAdapter(
                paymentRepository,
                customerAdapter,
                applicationContext.getString(
                    R.string.payment_intents_sheets_minimum_card_count_error
                ),
                defaultPaymentMethodSubject
            )
        )```
#

this is code for the activty where I present the googlepay UI when the googlepay button in customersheet is clicked.

#

Please let me know if I can provide any extra context

hexed turtle
#

Hm, offhand what's standing out to me is the difference between what you have and what is in our guide. I'm honestly not too familiar with the android environment. Is it because you don't have the activity = this, line like our guide does?

dusky mural
#

I don't think so, the guide is for XML based apps while I am trying to use compose in my app

#

and the object activity = this provides is later supplied within the compose SDK:

return remember(config) {
        GooglePayPaymentMethodLauncher(
            context = context,
            lifecycleScope = lifecycleScope,
            activityResultLauncher = activityResultLauncher,
            config = config,
            readyCallback = {
                currentReadyCallback.onReady(it)
            }
        )
    }```
hexed turtle
#

Hm, the exception makes me think it has something to do with that ActivityResultLauncher

dusky mural
#

yeah I think so too

#

but I'm not sure about what else to fix the exception

hexed turtle
#

Skimming stackoverflow, do you have more than one activity running in your app?

dusky mural
#

yep

hexed turtle
dusky mural
#

Yeah but in this case, the register call should already be made within the SDK.

 internal constructor(
        context: Context,
        lifecycleScope: CoroutineScope,
        activityResultLauncher: ActivityResultLauncher<GooglePayPaymentMethodLauncherContractV2.Args>,
        config: Config,
        readyCallback: ReadyCallback
    ) : this(
        lifecycleScope,
        config,
        readyCallback,
        activityResultLauncher,
        false,
        context,
        googlePayRepositoryFactory = {
            DefaultGooglePayRepository(
                context = context,
                environment = config.environment,
                billingAddressParameters = config.billingAddressConfig.convert(),
                existingPaymentMethodRequired = config.existingPaymentMethodRequired,
                allowCreditCards = config.allowCreditCards
            )
        },
    )```
hoary jackalBOT