in-app Consume subscriptions by user Android - android

i have an app which have to login to enjoy the features i have a premium subscription but the susbscription aplies to every user use the app i want to get subscribers by user and not by app
this is what i try do achieve:
user 1 -> premium subscription
user 2 -> adfree subscription
user 3 -> free
this is what is happening at the moment:
user 1 -> adfree subscription
user 2 -> adfree subscription
user 3 -> adfree subscription
how to achieve this?
im using https://github.com/anjlab/android-inapp-billing-v3

You're correct, IAB is based on gmail accounts and not based on users. You would have to devise your own logic for this kind of behavior, using a backend server. A general idea from the top of my head is:
Buy an in-app product using a gmail account.
Call your own server's API and register this orderId for this particular user that is active and store this information on the server.
Next time when the app is active, check for all the purchases for this gmail account.
Call your own server to check for active purchases/subscriptions for this active user.
Based on the response from 3 and 4, decide what is available for this user to enjoy.

Related

Can an Android / IOS single app have both Subscription and Full Purchase Methods?

I am new to Android / IOS apps development with React Native. I am using react-native-iap to implement in app purchases.
I want to know whether an Android / IOS single app can have both Subscription and Full Purchase Methods ?
If yes, what will happens
When user first subscribed the app, and then try to purchase the full app ? will subscription get cancelled ?
When user purchased full app and try to do a subscription ?
Thank you.
Subscriptions and "one-time-purchases" are different.
When you buy 2 subscriptions, you can manage the replacement of one by another one. Although, the behaviour is different in iOS and android:
On the Apple App Store, you have the notion of "subscription group". If you try buying another product in the same subscription group, the previous subscription will be automatically replaced by Apple (at the next renewal date for a downgrade, immediately for a crossgrade/upgrade).
On the Google Play Store, you don't have this notion and you'll have to manage the replacement by yourself (more info on this here: Allow users to upgrade, downgrade, or change their subscription)
When you want to replace a subscription by a one-time-purchase, you can manage the "replacement" manually on the Google Play Store, but not on iOS:
On Google, you have an API to cancel a subscription: use it after your user buy the "full-app"
On Apple, such API doesn't exist and the only thing you can do for now, is explaining to your user the different steps to cancel his subscription. You can help him with this deeplink: https://apps.apple.com/account/subscriptions
Opening this URL launches iTunes or iTunes Store and displays the Manage Subscriptions page where the user can upgrade, downgrade, or cancel their subscription by disabling auto-renew
Concerning the full app => subscription, I don't know. You could refund the purchase, but it would mean you would have lost money during the corresponding period of time.

How to handle subscription repurchase scenario in android in-app purchase?

I am maintaining and updating the subscription state through the real time developer notification.
When an user purchased a subscription in app, my server is called to link the purchase with the user.
Whenever user repurchases a subscription after expiry, I get a notification from Google pub-sub in my server as a "SUBSCRIPTION_PURCHASED" notification. I just don't know to which user I have to link this purchase? Since the repurchase is happening from the play store and it has no link with the app, I am unable to register the subscription to the user. Kindly please help me.
Just to clarify the different cases, even if I know that's not what you're asking for here :
whenever a subscription expires on the Play Store because of a payment issue, it enters in a grace period (if you havent deactivated this feature). If the payment method is not fixed, the subscription enters into an "account hold" period (30 days) where any payment method resolution or re-subscription will bring back the subscription. In this case, you'll receive a SUBSCRIPTION_RECOVERED S2S notification with the purchaseToken known by your server and everything should work just fine (more on this here: https://developer.android.com/google/play/billing/subscriptions#account-hold)
in your case, the user has re-purchased the subscription in another context than an "account hold", that's why you'll have an unknown purchaseToken and you won't be able to associate the subscription with any user. I'm afraid in this case, you can't do much.
The only solution for your user is to "restore" his subscription within your app. In another words, you should add a link in your Paywall which, when clicked, will retrieve the subscription from the Play Store and send them back to your server (like for a normal purchase). Your server will detect the new subscription and will linked the subscription to the correct user.
Here is an example of a Paywall with this restore link:
You could thought that it would be a good idea to always look in the Play Store for subscriptions when your app launch... and whenever your detect a subscription that isn't attached to your user, send the receipt to your server to attach the subscription to your user. It would be an error though since a same device can be used by 2 persons and one user would "steal" the subscription from the other.

Android In-App Purchase Downgrade-Upgrade

I have integrated in-app in my Andorid application for single Product productone.
For that, I have created different Product-Ids in my Google Play Console as below :
1. productone.monthly,
2.productone.yearly
As per my knowledge both the Product Ids will work independently since we can not group them together like it does in IOS-App Store.
Now, I have some doubts as below :
doubt 1 : If User purchased productone.yearly and payment done, What If User again by productone.monthly ?
and Vise Versa ?
I have to manage it from my side ? Like If I get that user purcahsed it for Yearly, I have to restrict the user to do not buy monthly subscription.
Please guide. Thanks.
Before coming to your two cases, note that you get all the purchase List from PurchaseResult object. So you get the purchase id lists. Now, there are two possible cases -
User has puchased your monthly product - 1. productone.monthly (if this is purchased, it will come in the list)
In this case, you can show the billing dialog for yearly product. As you want your user to pay more for your app (Of course yearly plan will cost more for user and you are building your app to make money).
User has puchased your yearly product - 2. productone. yearly (if this is purchased, it will come in the list)
In this case, you don't need to show billing dialog for monthly plan. As you don't want your user to pay less for your app (Don't allow plan downgrading).
Just in case you are thinking to allow both the options, follow this -
https://developer.android.com/google/play/billing/billing_subscriptions#Allow-upgrade

How to implement in app purchase in ionic 3

I am curios to implement in app purchase but there for i have some questions. I have already seen this post that helped to setup google account and products. I have created two subscriptions on google app purchase which is monthly and yearly with 7 day free trial also. Please see below my doubts and questions.
It seems i can get only one product at time with in app purchase 2 plugin
I need to show subscription list manually and click on each subscription will get product details ?
After purchase we need to store current subscription details on server side to maintain user current subscription ?
When auto renewal happen then do i need to register web-hook in google/apple developer account to notify our server so we can extend expiry date ? and with out web-hook is possible then how can achieve that and what can be pros and cons ?
What is basic idea to implement restore purchases if user login on second mobile with same google/apple account ?
Thanks,
Your help will be appreciated.

Android In-app subscription purchase with multiple user on a single device

I am developing an app with android in-app subscription purchase with a self login procedure, basically which means multiple user can use single device to access app. Everything works fine as long as i use a single user in my app, but as i logout and login another user and try to do a subscription purchase it either tells me you already have this subscription or changes my subscription to new requested subscription.
This happens because previous user had a subscription which is reflecting in this user, as subscriptions/purchases are associated with the primary play store account.
So How can i manage this situation with multiple user each with a same or different subscription on a single device? Is it possible ?
Thanks in advance for help.

Categories

Resources