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.
Related
I am using InAppBilling version 3 in my app, I am able to purchase subscriptions using test account. Now my question is how do I know the billing details in my app againt one subscription plan. Suppose I have purchase one plan and it renews Daily, Is there any provision or method to know that renew is done to this product with details(like for ex. product_id, time, date, update, renewing_status...etc). I have refered to this link.
And the other thing is that do a user can subscribed to multiple subscription at a time ?
After searching quite a bit, finally I found my solution. Google don't provide subscription order number for test purchases(if you are using test account to test your application without going to production). It only provide product_id, token, purchase_time, developer_payload, autoRenewing, package_name and purchase_state as if Google don't send details to Play Billing server as it is not a real purchase. Still your can implement your own logic as it provide autoRenewing = true(if product is in renewal state) and false(if product is in non-renewal state) with purchase_state = 0(purchased) , 1(canceled) and 2(refunded). And one more thing I came to know after reading documentation of Google that, test user who has taken the subscriptions the recur on daily basis, but they will only get the same details, which they get while purchasing a test subscription plan.
It provide order Id for real purchases with other details. If your subscription is monthly and your order Id is GPA.1234-5678-9012-34567 while purchasing the plan. Then next month Google append your order Id with GPA.1234-5678-9012-34567..0(second month) , GPA.1234-5678-9012-34567..1 (third month) and so on. So you can track your renewal of purchases with order Id as described in here. Rest are same.
How can i implement in-app purchases in my application?
I want to disable ads if the user paid me.
I spend a lot of hours to figure how it works by looking for tutorials.
I saw all the lectures on youtube about that.
I read on google developer site:http://developer.android.com/google/play/billing/billing_admin.html
I saw some example codes.
So,
I understood the concept
I know how:
1. create new product.
2. create a test account for testing.
3. publish my application to beta/alpha.
So,my question is:
What should I do in code?How to manage it correctly?
If user paid money for removing the ads how the application know if to show him the ads or not?Do i need to save the data locally manage it with SharedPreference or i getting the status about his purchases automatically? What will happen if the user replace his device?Google remember his account and his purchases?
I really need a basic example :(.
Like few methods that make "buy()" and "isOwned()" for checking if the current user has paid ..
Help me please
First of all implement In-app purchase in your application, you can follow this link.
When user purchased any item successfully, success status will be sent from google.
After purchasing successfully, store some flag value in SharedPreferences, SQLiteDatabase or in your server database through webservices.
Now whenever you are showing ads in your application, check flag value you have stored.
1. if flag shows that user have purchased item, don't show ads.
2. if flag value shows that user did not purchase anything show your ads.
Google remember his account and his purches?
Google will fetch all purchases from user's email id. You can restore purchase from the user, so whenever user uninstalls your app and you dont want user to purchase your item again, give them option of restore. Restore will give their product back and also give you success status.
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.
I have working app that sells in-app products (InApp billing v3).
Recently I've made an update for this app and made a terrible mistake there: I consumed some of purchases I didn't want to consume.
I issued an update and users updated the app and then wrote me they have no purchased access. (As I found later, I consumed wrong items).
So I have some questions now:
Is there a way to restore consumed purchases or I should return payments to my users?
Is there a way to find out how many and which purchases were consumed?
If returning payments, is there a way to find out if user still has the product or is it consumed with out changing the app (through google services)?
Thanks.
According to what I have understood from your question, It seems like you want to purchase product only once.
What I wished to ask: is there a way to request information about consumed products like about owned products.
you can get response or it's information in any type(Managed Product, Unmanaged Product, Subscription) in the onActivityResult method() check my below link.
In-app billing-v3 error in activity result
but I would not prefer you to manage it customly as you told for one time purchase product(not consumable product). You should go with the Manage product.
Managed In-app Products:
Managed in-app products are items that have their ownership
information tracked and managed by Google Play. When a user purchases
a managed in-app item, Google Play stores the purchase information for
each item on a per-user basis. This enables you to later query Google
Play at any time to restore the state of the items a specific user has
purchased. This information is persistent on the Google Play servers
even if the user uninstalls the application or if they change devices.
for more information about product type
you can query any time you want and you will get the product information, and even you don't need to manage if user has already purchase this product or not.
Is there a way to restore cnsumed purchases or I should return payments to my users?
Better option is you should give the payments back to the user and for the next time check the whole app once using dummy product "android.test.purchased" and update your app.
Is there a wat to find out how many and which purchases were consumed?
You have to check in the Google wallet because all transaction should be handle by the it, check if it gives you product type or not. Using your google developer console credential you can signed into google wallet.
If returning payments is there a way to find out if user stil has the product or is it consumed with out changing the app (through google services)?
as per above answer you have to check in google wallet, according to my knowledge they are provide us all of information about product type with user detail.
Let me know if I have not properly understood your question.
Hope it will solve your problem.
Is it possible to use google's in app billing mechanism for purchasing subscriptions for multiple user in my application? I have login/register mechanism implemented on my own server and users can purchase subscription to get news. But when i logout and login for another user, i dont have that subscription and have to pay again. I dont think thats possible with IAB android mechanism but i rather ask
I think i have a solution for this. Subscription will realy be only simple one-time item that can be purchased and my own server will handle expiration dates.