Inapp purchases and Subscriptions (Sell Once) android - android

I am providing levels in app (easy(unlocked),fun,crazy,hard)
want the users to buy only once and when they return they should have subscription.
I achieved it by saving in room database
But if I don't consume purchase it gets refunded. If I consume purchase when user comes back he has to buy again (the restore does not works)
What could be the solution?
If we use Subscriptions they are for specific period of time and user has to pay again for renewal but I want them permanent stick with that user.

For non-consumed purchases you need to acknowledge them or they will be automatically refunded in a couple days.
From the docs:
Note: If you do not acknowledge a purchase within three days, the user automatically receives a refund, and Google Play revokes the purchase.

Related

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.

Should a purchase be acknowledge again subscription renewal?

I'm implementing google in-app billing on my app. Normally, when a subscription reaches expire time, it will be automatically renewed. A new purchase is made (with the purchase token remain the same)
So, should my app acknowledge this new purchase or can I safely ignore it?
after rereading the google play in app billing documentation (https://developer.android.com/google/play/billing/billing_library_releases_notes#2_0_acknowledge)
"For subscriptions, you must acknowledge any purchase that has 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. To determine if a purchase needs acknowledgment, you can check the acknowledgement field in the purchase."
so basically, if the subscription is renewed, i don't have to acknowledge it.
i share the answer here for anyone interested in the same topic.
You simply periodically call billingClient.queryPurchases() if you use the billing libray, or mService.getPurchases() if using the AIDL
If the user has renewed the subscription, it will return that the user owns the item, if he decides not to renew it, after the grace period, if any, it will return that he does not own the item.

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.

InApp Subscriptions or Google Wallet

I have gone through most of the links here on stackoverflow and i have some doubts regarding InApp Subscriptions and Google Wallet.
What i know:
InApp Subscriptions basically allows a user to be able to subscribe to an app, say for example if it offers one year trial period, then once thats over, Google automatically handles the subscriptions then after.
Google Wallet, its a method that can be used to perform the purchase. What i don't understand is, can i use this method in order to allow users to use the app for one year, and then make them pay for the next years?
Billing continues indefinitely at the interval and price specified for the subscription. At each subscription renewal, Google Play charges the user account automatically, then notifies the user of the charges afterward by email. For monthly and annual subscriptions, billing cycles will always match subscription cycles, based on the purchase date. (Seasonal subscriptions are charged annually, on the first day of the season.)
This is what happens in my app:
1. A user logs in, and i get a date that probably keeps track of the billing cycle
2. If the sessions expired, the user is asked to pay using the inApp Billing serivce
3. Based on TrivailDriveApp Example, where we have the success log printed on subscription, we update the date of payment.
Some questions i have:
As per the quote from android, if the user is automatically subscribed to the service, and if a mail is sent to the user, does that mean that i would never be able to get a notification about the payment extension? How do i sync that with the server then?
Is my approach wrong in handling this kind of scenario? Or do i have to select a different method of handling app extensions?
P.S: There is no way of testing inapp subscriptions also. I wonder if i could do that without using real credit/debit card credentials.
EDIT:
I would also want to keep track of when the purchase or billing was done, if subscriptions are auto-renewed, then should i take up the purchase flow as an InApp Product instead of an InApp Subscription?
Please help.

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.

Categories

Resources