Consumption of canceled purchases on Google Play In-app Billing

I’m working on an application that uses Google Play In-app Billing V3 to sell a product that is valid for a certain period of time. After the user completes the purchase, I send the purchase data to our server and immediately destroy it if it is successful. The server then provides access to an additional service for that particular user until the end of the period. Note. I do not use subscriptions in the application.

I test purchases from test users in sandbox mode, where payment is not made. Most of them are successful, and this thread works great. However, sometimes my purchases are immediately canceled by Google. In the order history in my Google Checkout account, I see the line:

"For your protection, Google canceled this order. It is considered fraudulent."

Even if this happens, I can see that I get "purchaseState": 0 in the purchase data, which indicates success. In addition, an attempt to consume this product also IInAppBillingService.consumePurchase(version, package, token) calling IInAppBillingService.consumePurchase(version, package, token) returns 0). A request for my inventory at a later time shows that I have no purchases (and therefore no refunds / cancels), and I can buy the same product again. This is the same behavior as in a normal, failed state.

  • Does Google often cancel orders in the same way, outside a test sandbox?
  • Is it possible to cancel goods that have been successfully bought and used up (i.e. money returned) for reasons beyond the control of the developer?
  • Can I find out about canceling products that have already been used?
+6
source share
2 answers

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

Google has a fraud detection system that helps identify insecure payments. For example, if someone uses a stolen credit card or a credit card, it is used by several accounts, etc. In this case, the payment transaction will stop before it is launched (before the payment provider contacts it) with a message in your question. In May, this fraud detection system was not able to reliably detect test accounts, so you could see this message. He is currently a little better. In real life, this happens very rarely.

Can items that have been successfully purchased and canceled (i.e. money returned) for reasons beyond the control of the developer?

This is a difficult question because it is not the item that is canceled, but the payment transaction associated with that item. Theoretically, a transaction could be canceled later, but there must be a good reason for this. The same example with a stolen credit card can be used here. In real life, I had never seen this before.

Can I find out about canceling products that are already being consumed?

Although I have never tried this myself, I do not believe that the consumed product can be undone. As I said, the transaction associated with it can be canceled, but not a consumer product. This is due to the fact that the consumer product can be sold again, and so far there is no connection with the payment. If the product is not consumed, if it is placed in a canceled state, if the payment transaction assigned to it is canceled.

Hope this helps.

+1
source

I am setting up the same application.
The user can purchase the item, it will be tracked on my server and finally consumed, so the user can purchase the same item again.

I keep track of all the purchase information, and I tried to cancel an already consumed order. I can confirm that the status of the order will change (after 10 minutes more or less, you will also receive a letter of cancellation).

Calling this PurchaseAPI URL with your item and a Token purchase will return the purchase information:

 https://www.googleapis.com/androidpublisher/v2/applications/<app.package.name>/purchases/products/<productId>/tokens/<purchaseToken>?access_token=<myToken> 

The first time you get a similar answer:

 { "kind": "androidpublisher#productPurchase", "purchaseTimeMillis": "1458047931024", "purchaseState": 0, "consumptionState": 1, "developerPayload": "mypurchasetoken" } 

and after the cancellation of the purchase, the state will change:

 { "kind": "androidpublisher#productPurchase", "purchaseTimeMillis": "1458047931024", "purchaseState": 1, "consumptionState": 1, "developerPayload": "mypurchasetoken" } 

This is the same GET that I do for the first time to test the product.
It is probably wise to set up a periodic check of the status of the purchased goods and, in case of cancellation, update the purchase on the server.

0
source

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


All Articles