M
M
mitaichik2020-06-17 10:37:33
Android
mitaichik, 2020-06-17 10:37:33

Google Pay - how to avoid double charges when destroying an activity?

We are testing integration with Google Pay, but such a problem is also observed in the Google manual https://github.com/google-pay/android-quickstart - so this is not our jamb:

Test - payment works when destroying an activity after folding.

1. Open the Google Pay activity using AutoResolveHelper.resolveTask, a list of cards and a pay button are shown. 2. Minimize the application (the activity is destroyed)
3. Expand - the Google Pay activity is displayed again
4. Click the pay button. In theory, there should be a return to the activity of our application and a call to processActivityResult. In practice, the return to our activity occurs, but the processActivityResult is not called.

5. Open the Google Pay activity again using AutoResolveHelper.resolveTask.
6. We don’t turn it off anymore, but immediately press the pay button
7. We return to the activity of our application and call processActivityResult - BUT processActivityResult is called 2 times. Accordingly, the write-off of funds can occur 2 times.

The bug itself is not stable - once at a time it doesn’t have to - sometimes it works fine, often - not - with a 2nd write-off.

What to do with it, who knows?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question