Android: in lost transactions App Purchase

When you create a purchase order using the Android In App Purchase, sometimes a confirmation message is not sent to the Google market.

We saw cases when confirmations were sent a few hours after the purchase itself, thus leaving the user in a state where their credit card was billed, but they did not see the purchase in our product. see http://code.google.com/p/marketbilling/issues/detail?id=14#makechanges

+4
source share
1 answer

It turned out that the request "restore Transactions" also sends back unmanaged transactions that have not received confirmation that they were received by your product.

Here is a solution that works for both managed and unmanaged products:

  • When a user wants to purchase, first set the pref value (for example, RESTORE_TRANSACTION_NEXT_TIME ) to true , and then send the purchase request to the market.
  • On your onBillingSuppored check that the pref is true , and if it fulfilled billingService.restoreTransachtions()
  • In onPurchaseStateChange (): where purchaseState == PurchaseState.PURCHASED) set RESTORE_TRANSACTION_NEXT_TIME to false

This will automatically recover the lost transaction.

+5
source

Source: https://habr.com/ru/post/1445307/


All Articles