How to handle pending purchases from Google Play

I agree the documentation is poor, especially since the one time you want to know exactly what's happening is when you're handling other people's money!

It looks like a 'slow card' transaction is actually a 'pending purchase', something Google have been rolling out in 2019. Here's the probable flow...

  • In your app the user taps 'Buy now'
  • They see the Google checkout overlay
  • They choose "Pay at Freddina's Grocery, Accra" (a local store that's signed up to deal with Google pending purchases)
  • Google checkout displays a code to show to Freddina
  • User pays Freddina in cash and Freddina processes the payment using that code
  • 10 mins or so later, the purchase update will land in your app

As for handling unpredictably timed update events, we have an app with a handlePurchaseUpdated method listening out from the moment the app starts, and makes changes based on the Purchase object that comes with it. Here's an example flow:

  • We listen for purchase updates as soon as the app starts up
  • User makes a slow purchase
  • We get a purchase update
  • The passed Purchase object has purchase state PENDING
  • We tell the user that we'll notify them when the purchase is complete
  • At some point in the future (e.g. next day after an app restart) the purchase update comes in
  • If the purchase state is now PURCHASED we finalise the purchase and tell the user

Note: Ours is a ReactNative app, not native java, but the flow should be the same.

It's complicated to implement because you have to pick your time to make your purchase changes and display the purchase result at a time that makes sense, not necessarily when the purchase update arrives 5 secs after startup (or any other weird time). And it gets more complicated if there are errors during your grant-entitlement or acknowledgement steps, urgh.

Also, you might not be seeing the 'slow card' tester option because you didn't allow it?


Update for 2022: Personally I feel the documentation is still so poor, and the complexity so great, that I would recommend using a service like IAPHUB to manage iaps and subscriptions.


It sounds like you are not acknowledging the purchase. See below from the Google Play Billing documentation:

If you use the Google Play Billing Library version 2.0 or newer, you must acknowledge all purchases within three days. Failure to properly acknowledge purchases results in those purchases being refunded.