Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consuming cancelled purchases on Google Play In-app Billing

I am working on an application which makes use of Google Play In-app Billing V3 to sell an item which valid for a certain period of time. After a user makes a purchase, I send the purchase data to our server and immediately consume it, if successful. The server then grants access to the extra service for this particular user until the period ends. Note: I am not using in-app subscriptions.

I am testing purchases with test users in the sandbox mode where payment is not taken. Most of them are successful and this flow works fine. However, sometimes, my purchases are cancelled by Google immediately. In the order history in my Google Checkout account, I see the line:

"For your protection, Google cancelled this order. The transaction was considered fraudulent.".

Even if this happens, I see that I receive a "purchaseState": 0 in the purchase data, indicating a success. Also, trying to consume this product also results in success (calling IInAppBillingService.consumePurchase(version, package, token) returns 0). Querying my inventory at a later time shows that I have no purchases (and therefore no refunds/cancels) and I am able to freely purchase the same item again. This is the same behavior as in the normal, uncancelled state.

  1. Does Google often cancel orders in the same way, outside of the test sandbox?
  2. Can items which were successfully purchased and consumed still be cancelled (i.e. money refunded) for reasons outside of the control of the developer?
  3. Is it possible to know about cancellations for products which have already been consumed?
like image 920
antonyt Avatar asked May 29 '13 08:05

antonyt


1 Answers

Does Google often cancel orders in the same way, outside of the test sandbox?

Google has a fraud detection system which helps to identify unreliable payment. For instance if someone uses a stolen credit card or same credit card is used by multiple accounts, etc. In this case payment transaction will stop even before it starts (before a payment provider is contacted) with the message in your question. In May this fraud detection system was not able to reliably detect test accounts, that is why you could see this message. Nowadays it is slightly better. In real life this happens very rare.

Can items which were successfully purchased and consumed still be cancelled (i.e. money refunded) for reasons outside of the control of the developer?

This is a tricky question, because what gets cancelled is not an item, but rather a payment transaction associated with this item. Theoretically, a transaction can be cancelled also later in time, but there must be a good reason for that. Same example with a stolen credit card can be valid here. In the real life I have never seen it before.

Is it possible to know about cancellations for products which have already been consumed?

Although I never tried it myself, I don't believe a consumed product can be cancelled. As I said, an associated payment transaction might be cancelled, but not a consumed product. It is because a consumed product can be sold again and there is no connection to a payment yet. If product is not consumed, if will be put into cancelled state, if a payment transaction assigned to it gets cancelled.

Hope this helps.

like image 77
sergej shafarenka Avatar answered Nov 08 '22 13:11

sergej shafarenka