Back on card payment make the SDK unusable
Kevinrob opened this issue · 15 comments
Hi,
We found a bug with the card payment process.
Steps to reproduce:
- Start a payment with VISA, Mastercard or AMEX
- The bottom sheet open, asking for card numbers
- Close the keyboard and do a system back (with the button or with gesture)
- 💥 The SDK is unusable. We don't receive any callback
onTransactionError
noronTransactionCancel
.startTransaction
doesn't work anymore.
UPDATE / TL;DR: This is caused by predictive back gesture feature (enableOnBackInvokedCallback)
Hello @Kevinrob,
Can you give us a mobile token for that use case?
Are you perhaps using compose?
Also, are you able to record a video of this bug happening? As I am not being able to reproduce on version 3.1.1 I would like to see how it happens. In version 3.1.0 we added a condition that when testing mode is enabled you can record our window.
Thank you!
Mobile Token: 29e841c68570e0ef1821277137f74e8c03335bf07b5ce5f7
Yes, we use Compose.
It's with the version 3.1.1
.
device-2023-06-29-094358.mp4
When I try after making the backs, I get errors in logcat:
A transaction with mobileToken '29e841c68570e0ef1821277137f74e8c03335bf07b5ce5f7' is already in progress
Hello @Kevinrob,
I have here an Android SDK sample project in Compose with exactly the same init as yours on that mobile token.
Can you run it and check if the device you are using behaves the same way on this project?
I tried this sample on:
Device Pixel 7 Pro (Android 14)
Emulator Pixel 6 (Android 13)
Emulator Pixel 6 (Android 9)
Emulator Pixel 6 (Android 5)
All worked as expected.
Thanks!
I test on a Pixel 7 Pro too.
With the sampleapp, I get the Transaction CANCELLED
message 👍🏻
I don't understand why I don't get it in my application. We start the transaction the same.
Do you have custom logic for cancelling the transaction on back press?
Maybe you can add some log to a build that I can try?
Hello @Kevinrob,
I created a version for you to test with logs on our back pressed logic. You can only see these logs in testing mode (isTesting = true
).
The version is "1.0.0-QoQaVersion311".
Two examples of logs with the Android SDK Sample project:
When two payment methods are display and we go back on credit card screen:
ch.datatrans.sdksample D/Datatrans: onBackPressed
ch.datatrans.sdksample D/Datatrans: onBackPressed: Back or Cancel SDK
ch.datatrans.sdksample D/Datatrans: onBackPressed: Back
When only the credit card screen is displayed:
ch.datatrans.sdksample D/Datatrans: onBackPressed
ch.datatrans.sdksample D/Datatrans: onBackPressed: Back or Cancel SDK
ch.datatrans.sdksample D/Datatrans: onBackPressed: Cancel SDK
Thanks!
I think I found the cause of the problem.
android:enableOnBackInvokedCallback=true
in the manifest.
This is from predictive back gesture feature.
If I remove it, it's works.
I get the cancellation callback and I see the 3 logs onBackPressed
.
For the moment we will disable this in our application.
But maybe there is something to do in the SDK for supporting this?
Hello @Kevinrob,
I just tried it out too. Yes, that affects our back pressed behaviour.
We will analyse when we can release a fix to support it and will inform you in this ticket whenever it is released.
Thank you again for bringing it up!
Hi @luiscosta,
any updates on this?
Hello,
I just tried my Compose Sample App (the same one I sent to you) with Datatrans SDK 3.3.0 and the flag android:enableOnBackInvokedCallback="true"
and it worked fine for me, I receive the cancels and successes.
Do you still see this problem in 3.3.0?
Please let me know.