6

I have created a android application. Subscription is free. However I have put ads inside application. Now I want provide option within app where people can buy ad-free version. And also provide option to restore purchase.

I went through Android docs didn't understand anything. Please provide a good tutorial.

halfer
  • 19,824
  • 17
  • 99
  • 186
virendrao
  • 1,763
  • 2
  • 22
  • 42
  • https://github.com/anjlab/android-inapp-billing-v3 – Naveen Tamrakar Oct 28 '14 at 06:00
  • http://www.androidhub4you.com/2013/03/how-to-inegrate-in-app-purchase-billing.html – Naveen Tamrakar Oct 28 '14 at 06:01
  • http://www.techotopia.com/index.php/Integrating_Google_Play_In-app_Billing_into_an_Android_Application_%E2%80%93_A_Tutorial – Rahul Oct 28 '14 at 06:08
  • @rahul i dont know much about in app purchase i can provide option to buy my own app and how to handle restore purchase. I am providing two buttons one for first time buy and next for restore purchase of my app – virendrao Oct 28 '14 at 06:09

4 Answers4

3

Hey I had worked on InApp Purchase recently and I've successfully integrated in my existing app and ready to make it live. Initially when i had started doing this I've downloaded google InApp Billing Example called "Trivial Drive" from here.

But it didn't help me much as it has lots of issues and bugs, So I've decided do it on my own from scratch using new v3 api which you can find here. This tutorial has clear explanation that would help you and also if you have time, see this youtube video where google employee had explained clearly how to integrate it.

Also if you want quick example, I've a sample app which you can download from here.

The following video also explains how to integrate InApp Purchase. Please go through it.

https://www.youtube.com/watch?v=-h2ESH71hAI

Thank you

Ramesh
  • 1,252
  • 3
  • 12
  • 30
  • I want to provide in-app purchase of same app but ad free then i can upload same apk in in-app billing product section? – virendrao Oct 30 '14 at 08:44
  • i didn't get your question, can you elaborate more ? – Ramesh Oct 30 '14 at 09:19
  • I have an app for free but i have ads in it. Now i have created screen in my app where user can buy ad-free version on click of button. So do i have two different apks or same apk with handling for checking if purchased. – virendrao Oct 30 '14 at 09:25
  • 1
    Use the same apk, write the code in such a way that the app should check purchase every time when user opens the app. Then disable/enable ads based on the purchase response that you get from getPurchases() method. If user has purchased the item then don't show the ads, if not show it. – Ramesh Oct 30 '14 at 11:00
  • thanks ramesh... One more thing if user uninstalls app and we query will the product will be avaliable right.. i dont need to provide option to buy until and unless i consume it ? – virendrao Oct 30 '14 at 11:54
  • yes, you are correct. You don't need to provide option to buy if user has already purchased. – Ramesh Oct 31 '14 at 07:38
  • okay for first i will have one button to buy and user clicks it this button gets disable until its consumed. And at start of app just check query purhcases and disable ad in-app billing apk as both apk will be same for main app and in-app billing..Right? – virendrao Oct 31 '14 at 09:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63993/discussion-between-ramesh6233-and-vo12). – Ramesh Oct 31 '14 at 09:26
  • i did setup tester account with apk upload in beta testing mode but get this error:"The item you were attemptinh to purchase could not be found." I uploaded apk 3 hrs before – virendrao Nov 01 '14 at 10:27
  • are you testing with signed apk? some times it would take 5 to 6 hours to appear in the app. – Ramesh Nov 03 '14 at 10:53
  • tested working fine now.. need to do some researching :) – virendrao Nov 03 '14 at 11:09
0

Refer this question on SO Implementing In App purchases in Android?. Also for official documentation of The In-app Billing Version 3 API refer this link http://developer.android.com/google/play/billing/api.html

Community
  • 1
  • 1
Mukesh Rana
  • 4,051
  • 3
  • 27
  • 39
0

This is how you create In app purchase inside your app.

1) In your developers console, go to your application and create a in app product(Name it as Ad-Free Access or what ever).(Note: to create a in app product you need to have a merchant account).

2) If you have a merchant account ready, create a InApp Product with the type of Subscription(One time or monthly or yearly) and price.

3) Once you have created the InApp product successfully, you can prompt the user to purchase an InApp product by quering a list of in app products in your app and ask user to purchase them.

Here is a link to query the InApp products:

4) Once a user purchase the product, based on the purchase status of the product, you can disable the ads in your app.

Akhil
  • 189
  • 7
0

The Simple and very easy way to implement in-app through a library anjilab. Just add the dependecy

implementation 'com.anjlab.android.iab.v3:library:1.0.44'

Add Permission, implement methods and you done. For any issues you can see here issues

Andronicus
  • 25,419
  • 17
  • 47
  • 88