#yogenp

1 messages · Page 1 of 1 (latest)

wind gorgeBOT
tulip barn
#

We're collecting the Payment Method first before creating the PaymentIntent and the Subscription

steel estuary
#

I'm not entirely sure that's supported to be honest.
Can you look at Logcat and see what types of warnings/errors are happening there at the time this happens?

tulip barn
#

None, unfortunately. Everything looks good in the beginning, then I can see that the delegate is calling my backend to create payment intent and then I get the error "Something went wrong"

steel estuary
#

what does your code look like/what version of stripe-android is it?

tulip barn
#

Version: 20.34.4
This is the code:

    activity = activity,
    createIntentCallback = { paymentMethod, _ ->
        try {
            paymentIntentCallback?.onCreateIntent(paymentMethod.id.toString()) ?: CreateIntentResult.Failure(
                cause = NullPointerException("paymentIntentCallback is null"),
                displayMessage = "Failed: paymentIntentCallback is null"
            )
        } catch (e: Exception) {
            e.printStackTrace()
            CreateIntentResult.Failure(e, e.message)
        }
    },
    paymentResultCallback = ::onPaymentSheetResult
)```

and 

private val paymentIntentCallback = PostagePaymentService.PaymentIntentCallback { paymentMethodId ->
val hardwareOrderModel = HardwareOrderModel(
stripePaymentMethodId = paymentMethodId,
deliveryAddress = purchaseModel.deliveryAddress,
merchantHardware = hardwareInfo?.createHardwareOrderList()!!
)
val result = repository.orderHardware(
TerminalParams.RequestBodyParam(
merchantServices.getCurrentMerchantId(),
requestBodyUtils.getRequestBodyFromDataClass(hardwareOrderModel)
)
)

if (result.isSuccess()) {
    clientSecret = result.extractData().clientSecret
    CreateIntentResult.Success(clientSecret)
} else {
    val error = result.extractError().toString()
    CreateIntentResult.Failure(
        cause = Exception(error),
        displayMessage = "Failed: $error"
    )
}

}

#

And showing the Payment Sheet:

val intentConfig = PaymentSheet.IntentConfiguration(
    mode = PaymentSheet.IntentConfiguration.Mode.Payment(
        amount = amount,
        currency = merchantServices.getCurrencyCode()
    )
)

val appearance = PaymentSheet.Appearance(
    shapes = PaymentSheet.Shapes(
        cornerRadiusDp = 8.0f,
        borderStrokeWidthDp = 1f
    ),
    typography = PaymentSheet.Typography.default.copy(
        fontResId = R.font.poppins_regular
    )
)

val googlePayConfiguration = PaymentSheet.GooglePayConfiguration(
    environment = if (BuildConfig.DEBUG) {
        PaymentSheet.GooglePayConfiguration.Environment.Test
    } else {
        PaymentSheet.GooglePayConfiguration.Environment.Production
    },
    countryCode = merchantServices.getCurrentMerchant().country,
    currencyCode = merchantServices.getCurrencyCode()
)

paymentSheet?.presentWithIntentConfiguration(
    intentConfiguration = intentConfig,
    configuration = PaymentSheet.Configuration(
        appearance = appearance,
        merchantDisplayName = "Lopay Ltd",
        googlePay = googlePayConfiguration
    )
)
steel estuary
#

I've never had a chance to integrate with this new deferred flow via presentWithIntentConfiguration unfortunately. I would imagine it's probably that it doesn't work if the PaymentIntent comes from a Subscription Invoice, that is definitely a problem we have in general right now

#

without seeing the actual logcat line or reason for the failure I can't say much more and I can't replicate this quickly on Discord(we could in a support ticket) so unforunately for now that's my best guess

tulip barn
#

Is there any possible workaround that I could try in the meantime?

steel estuary
tulip barn
#

@steel estuary Is there a way to enable verbose logging for the SDK and the whole payment flow I'm trying to implement?
That would be very helpful in resolving these issues

steel estuary
#

not that I know of, I think it's just as verbose as it is by default, there aren't different levels

#

whenever I've had problems I usually easily find the error in logcat

tulip barn
#

Interesting, my PaymentSheet is not surfacing anything in the logcat

steel estuary
#

we can definitely dig into this but will take a little while to replicate. But I'm 95% certain it will come down to "sorry, the deferred intent integration flow on mobile is not compatible with Subscription Invoice PaymentIntents", there's multiple issues between deferred<>subscriptions and mobile<>deferred which we're slowly fixing so unfortunately you're in a product gap area

tulip barn
#

Understood. Also, how come this issue doesn't really affect the iOS implementation?

steel estuary
#

not sure, because I don't know what the actual underlying issue is

tulip barn
#

Okay, no worries. Thanks

steel estuary
#

sorry, I don't want to chat too much when really the next step is for us to spend some time replicating the exact problem and understanding it at a technical level, that's mostly my job and I like doing it. Unfortunately Discord doesn't work for that since it's going to take an hour or two to get this set up so it works better as an async support ticket

wind gorgeBOT
hollow osprey
#

make sure to include all relevant information there (code, reproduction steps, error messages, relevant object IDs, etc.)