#oscarcodes
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Give me a second to look
Thank you
If you click on the "X", does it take you back to the app?
It does, but fails to add the bank account details
I see. Are you testing on the emulator or a real device?
On an emulator
Have you tried on a real device to see if it behaves differently?
Interesting.. Are you using the same exact code from our guide?
For the most part yes. This screen is set up using jetpack compose, thus isn't completely 1 to 1 with the source code presented here https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#flowcontroller
For jetpack compose we use the following
`val stripeLauncher = rememberLauncherForActivityResult(
contract = PaymentSheetContract(),
onResult = {
when (it) {
is PaymentSheetResult.Failed,
is PaymentSheetResult.Canceled -> {
viewModel.send(PaymentMethodAction.PaymentMethodsStripeKeysClear)
}
is PaymentSheetResult.Completed -> {
viewModel.send(PaymentMethodAction.PaymentMethodUpdated)
viewModel.send(PaymentMethodAction.PaymentMethodsStripeKeysClear)
viewModel.viewModelScope.launch {
viewModel.load(forceRefresh = true)
}
}
}
}
)`
When you click on the CTA, does it hit the .Completed condition in your code at all?
I'm not super familiar with Jetpack compose myself
It does not hit any success or error conditions
Also nothing in the logcat is indicative of an error
The code above is similar to the following documented callback
fun onPaymentSheetResult(paymentSheetResult: PaymentSheetResult) { when(paymentSheetResult) { is PaymentSheetResult.Canceled -> { print("Canceled") } is PaymentSheetResult.Failed -> { print("Error: ${paymentSheetResult.error}") } is PaymentSheetResult.Completed -> { // Display for example, an order confirmation screen print("Completed") } } }
Gotcha. And can you share the code you're using to present PaymentSheet?
PaymentSheetContract.Args.createSetupIntentArgs(
clientSecret = viewAction.setupIntentInformation.customerIntentSecret,
config = PaymentSheet.Configuration(
merchantDisplayName = viewAction.setupIntentInformation.merchantName,
customer = PaymentSheet.CustomerConfiguration(
id = viewAction.setupIntentInformation.customerId,
ephemeralKeySecret = viewAction.setupIntentInformation.customerEpheralSecret,
),
allowsDelayedPaymentMethods = true,
allowsPaymentMethodsRequiringShippingAddress = true
)
)
)```
Can you share the SetupIntent ID too?
Also what version of the SDK are you running?
setupIntentId - seti_1Nk5dbKA296nhejwPBvo3x41_secret_OX9xAOfK5w3UgJ1vlvXQEe47V0rVpAu
stripe = "20.25.5"
stripeLauncher.launch is equivalent to what? flowController.configureWithPaymentIntent. ?
contract = PaymentSheetContract(),
onResult = {
when (it) {
is PaymentSheetResult.Failed,
is PaymentSheetResult.Canceled -> {
viewModel.send(PaymentMethodAction.PaymentMethodsStripeKeysClear)
}
is PaymentSheetResult.Completed -> {
viewModel.send(PaymentMethodAction.PaymentMethodUpdated)
viewModel.send(PaymentMethodAction.PaymentMethodsStripeKeysClear)
viewModel.viewModelScope.launch {
viewModel.load(forceRefresh = true)
}
}
}
}
)```
It's a request to start an activity for result
Where are you using flowController.configureWithPaymentIntent? I mean what would be jetpack compose == to that
I'm fairly confident the equivalent is
stripeLauncher.launch( PaymentSheetContract.Args.createSetupIntentArgs( clientSecret = viewAction.setupIntentInformation.customerIntentSecret, config = PaymentSheet.Configuration( merchantDisplayName = viewAction.setupIntentInformation.merchantName, customer = PaymentSheet.CustomerConfiguration( id = viewAction.setupIntentInformation.customerId, ephemeralKeySecret = viewAction.setupIntentInformation.customerEpheralSecret, ), allowsDelayedPaymentMethods = true, allowsPaymentMethodsRequiringShippingAddress = true ) ) )
Hmm the reason I am asking is because I am not sure if you're using the flowcontroller flow or just the regular paymentsheet flow.
Ok thank you, can you explain the difference please
And why this is important for context
The flowcontroller flow allows you to complete payment/setup in your own UI
https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#flowcontroller
So you'd likely need to deal with UI handling to a degree
When the customer finishes, the sheet is dismissed and calls the paymentOptionCallback passed earlier in create. Implement this method to update your UI with the returned paymentOption.
https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#flowcontroller:~:text=collect payment details.-,When,-the customer finishes
So are you suggesting that the reason the success webview hangs is because this isn't configured in our app?
yes
exactly
Since there are no errors, crashes and it doesn't even hit the result block
There is no documentation of how this would work in Jetpack compose
Hi ๐
I'm taking over as @nova charm had to go.
You are correct that our Android code examples currently do not utilize Jetpack Compose
For example, the create() function for the flowController is only practical for usage in fragments or activities
Hi Snufkin
Can I just verify that So are you suggesting that the reason the success webview hangs is because this isn't configured in our app? is truly the issue?
Well if @nova charm didn't see any errors in your account logs and you aren't seeing any errors logged from the Stripe SDK, that would strongly suggest this is where the issue lies.
Is none of the code in your onResult block firing?
That's right, none are firing
except for credit cards, that works well
Just connecting with my team, please keep this thread
We have to archive threads after a period of inactivity but you can always come back and ask again
That's fair, I won't be long
Do you have any examples of payment sheet with jetpack compose
No we do not