Test subscription is revoked by GooglePlay - android

I'm working on a subscription renewal feature, in test mode, with testing payment methods. Problem is that we receive cancelation subscription webhook, GooglePlay makes subscription revoke. ​​
From params:
​"cancelReason": "1"
Status code from the docs,
Subscription was canceled by the system, for example, because of a
billing problem.
Also from the docs
Revoking a subscription instantly removes access to the subscription
and is usually done when you or Google suspects fraud.
Usually, it sends cancelation webhook immediately after renewal, even when it was successful, so there are cases when I got two e-mails, about renewal success and cancelation. In my case renewal called after 5 minutes (doc)
Have someone idea, what could be the reason? Is it some "Google anti-fraud system". Because for testing purpose we have short subscription period but the big price. But probably anti-fraud should not be executed when we do testing, with testing payment methods, when there is no real transaction.

The problem was, that we didn't acknowledge new subscriptions.
From the docs:
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.
Regarding subscriptions:
For subscriptions, you must acknowledge any purchase that contains a
new purchase token. This means that all initial purchases, plan
changes, and re-signups need to be acknowledged, but you do not need
to acknowledge subsequent renewals.
Test acknowledging purchase with license testers:
For purchases made by license testers, the acknowledgment window is
shorter. Instead of three days, purchases are refunded and revoked if
they are not acknowledged within five minutes.
UPDATE
changes in documentation
You should also verify that purchases are properly acknowledged as
described in processing purchases. For purchases from license testers, a > purchase will be refunded after 3 minutes if your app does not
acknowledge the purchase and you will receive an email about the
cancellation. You can also check the Orders tab in the Google Play
Console to see if an order was refunded after 3 minutes.

Related

Inapp purchases failing to acknowledge

I'm having some trouble dealing with the new inapp billing library (version 4)
Ever since I updated the billing library in my app some user purchases are failing to be acknowledged, therefore they get refunded within 3 days, while other work just fine.
My theory is that because of the app only sending an acknowledge request once when a SKU is bought, said request might sometimes fail and the thing remains unacknowledged. That'd explain why some purchases are working and other aren't, getting refunded in the process.
I thought of writing a condition that always sends an acknowledge request whenever a SKU is purchased but isn't acknowledged as a possible solution. This would always send an ackowledge request as long as it's purchased and not acknowledged, therefore if the acknowledge request fails it'd just send it again until it's approved.
I was wondering if successfully processed inapp purchases failing to acknowledge is common?
Check it https://developer.android.com/google/play/billing/integrate#process play billing document, you use to subscription package to acknowledge
Once a user completes a purchase, your app then needs to process that purchase. In most cases, your app is notified of purchases through your PurchasesUpdatedListener. but there are cases where your app is made aware of calling BillingClient.queryPurchasesAsync() as described in Fetching purchases.
Your app should process a purchase in the following way:
Verify the purchase.
Give content to the user, and acknowledge delivery of the content. Optionally, mark the item as consumed so the user can rebuy the item.
To verify a purchase, first, check that the purchase state is PURCHASED. If the purchase is PENDING, then you should process the purchase as described in Handling pending transactions. For purchases received from onPurchasesUpdated() or queryPurchasesAsync(), you should further verify the purchase to ensure legitimacy before your app grants entitlement. To learn how to verify a purchase properly, see Verify purchases before granting entitlements.
Once you've verified the purchase, your app is ready to grant entitlement to the user. After granting entitlement, your app must then acknowledge the purchase. This acknowledgment communicates to Google Play that you have granted entitlement for the purchase.

Android Google Play Billing Library v2/v3: How to stop someone maliciously preventing an acknowledgement and therefore get their purchase refunded?

I've been implementing Google Play Billing Library v3, and noticed that starting v2 we must acknowledge a purchase after granting entitlement to the purchased feature, otherwise the user is refunded within 3 days. So essentially the lifecycle is something like:
User purchases something, e.g. subscription to a premium account.
The client app sends the purchase and signature to the backend so the user is entitled to the purchase, e.g. premium account.
The backend responds with a success, we then acknowledge with Google Play the purchase was entitled (otherwise a refund is given).
However, that got me thinking, what is stopping a malicious user from modifying the APK (or even blocking the network call) so that the acknowledgment call is not made, therefore the user is refunded within 3 days, but entitlement (step 2 above) is still given. What can I do the stop this within my app? How can I make sure the acknowledgment definitely goes through if the entitlement is given?
If no acknowledgement is made and after 3 days gets refunded, the purchased items query to the google servers will return an empty list, so you will know he is not entitled.
If a user keeps on purchasing the same item, and cancelling it due to not acknowledgement or other mechanisms, this should trigger Google alarms, and probably the user's payment method will be revoked. Google purchase system has many mechanisms in-place at server level to verify that purchases are genuine.

Android In-App Subscription PurchaseState is always 0

In my android app using in-app subscription monthly plan. I have purchased a subscription product with test account. After one hour I cancelled it manually from my phone.
After I query using inventory.getPurchase(monthlyplan), I always get purchase state is 0.
I waited more than one day; still getting response of purchase state is 0. Can any one help me on this?
You may want to check this document - Subscription Cancellation:
Users can view the status of all of their subscriptions and cancel them if necessary from the My Apps screen in the Play Store app. Currently, the In-app Billing API does not provide support for programatically canceling subscriptions from inside the purchasing app.
When the user cancels a subscription, Google Play does not offer a refund for the current billing cycle. Instead, it allows the user to have access to the canceled subscription until the end of the current billing cycle, at which time it terminates the subscription. For example, if a user purchases a monthly subscription and cancels it on the 15th day of the cycle, Google Play will consider the subscription valid until the end of the 30th day (or other day, depending on the month).
Important: In all cases, you must continue to offer the content that your subscribers have purchased through their subscriptions, as long any user is able to access it. That is, you must not remove any content while any user still has an active subscription to it, even if that subscription will terminate at the end of the current billing cycle. Alternatively, you can use the refund and revoke API to revoke each subscriber's subscription (one by one) and refund their subscription payments. Removing content that any subscriber is entitled to access will result in penalties. Please see the policies document for more information.
There are some good insights regarding the following (also found in the same document):
App uninstallation
Refunding and revoking subscriptions
Here is a related SO question that also talk about cancelling subscription in-app.

Refund to In App Purchase on Android

I have an in app purchase that unlocks part of the app for a year. Its setup as Annual Subscription.
Temporarily running a promotion unlocking premium as one-time purchase.
One of the users emailed me and wanted to take advantage of the promotion. So I'm thinking Cancel / Refund his Subscription, and ask him to purchase again as one-time purchase.
My question is what happens after I cancel / refund his subscription order, does IAB still consider it a valid purchase or not ?
What happens when you queryInventory, is it no longer returned as his purchase or is it stilled returned and I have to handle the status somewhere in code?
You have to do it in your Google Wallet Merchant. Read this Google Documentation:
Once an order is refunded - on a non-rooted device - the order will be invalid if queried. IAB considers it as a purchaseState==2 (2 is refunded according to Table 4 in here). Note that the developer will be in charge to handle refunded items. Read this question.

Android In-app subscriptions purchaseStatus not changed after refund

I'm trying to implement in-app subscription in my application. Everything seems to work ok, except for refund. I made a test account, and bought test subscription. In response got "purchaseState" : 0 (purchased). I immediately issued a refund through a Merchant Console, in response I got same "purchaseState" : 0.
Shouldn't I be notified of refund, so i can cancel subscription on my end? How do i handle refunds for subscriptions? I understand cancellations - state will be changed after expiration date. But refunds..
Refunds are not supported for subscriptions. I recently implemented subscriptions in our Android app and had some of the same questions and saw the same results but confirmed that 'refund' state is never sent for a subscription. Mostly because Google does not give you a refund (unlike in-app billing).

Categories

Resources