#yogenp
1 messages · Page 1 of 1 (latest)
We're collecting the Payment Method first before creating the PaymentIntent and the Subscription
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?
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"
what does your code look like/what version of stripe-android is it?
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
)
)
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
Is there any possible workaround that I could try in the meantime?
don't use the deferred flow with separate PM-creation and instead use presentWithPaymentIntent using the client_secret directly https://stripe.com/docs/payments/accept-a-payment?platform=android&ui=payment-sheet#android-collect-payment-details
@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
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
Interesting, my PaymentSheet is not surfacing anything in the logcat
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
Understood. Also, how come this issue doesn't really affect the iOS implementation?
not sure, because I don't know what the actual underlying issue is
Okay, no worries. Thanks
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
hi! I'm taking over this thread. I recommend writting to support, they will have more time to look into your issue: https://support.stripe.com/contact
make sure to include all relevant information there (code, reproduction steps, error messages, relevant object IDs, etc.)