12

Google came with with the idea of introductory price (https://support.google.com/googleplay/android-developer/answer/140504?hl=en).

My question is related to its API. I can't find the way how to get information about this via Purchases.subscriptions (https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get)

Even when I buy a subscription for introductory price and I asked Google Play Developer API for the information about that subscription, I see only the full price.

Even the inappproduct/get does not have any information about introductory price linked to certain product.

Do you have any idea how to get proper price? Thx

Tomas Pavlatka
  • 121
  • 1
  • 3
  • How are you calling the API? Can you post your code? – Ruben Steins Dec 08 '16 at 09:17
  • There is no information to obtain I think. If there were it should be in getSkuDetails, see https://developer.android.com/google/play/billing/billing_reference.html – Paul Woitaschek Jan 04 '17 at 08:34
  • @PaulWoitaschek Sounds very strange. It means that user cannot be aware of introductory price when he/she purchases subscription? – MyDogTom Apr 05 '17 at 12:13
  • @TomasPavlatka Have you found any solution? – MyDogTom Apr 05 '17 at 12:14
  • Im curious about this also...is there a way to get the introductory price from Google API, since the Sku json doesn't include it. – box May 29 '17 at 10:25
  • @box did you figure out how to get the information about introductory period to the server? a few months passed and still the json does not have anything, and the receipt that Google sends back to the server seems to not have anything either. – XAnguera Feb 01 '18 at 19:08
  • @XAnguera Hey yes I did, you need to implement the new billing library https://developer.android.com/google/play/billing/billing_library.html where you need to call getIntroductoryPrice() on SkuDetails object. Also the sku returned from the API should have introductoryPrice https://developer.android.com/google/play/billing/billing_reference.html#billing-codes – box Feb 02 '18 at 12:11
  • 1
    @box thanks for the links, but are you doing these on the *server*? the API's you are referring to are for the apps... – XAnguera Feb 03 '18 at 01:07
  • @XAnguera Thats for the Android client, the second link points you to the server API response. – box Feb 03 '18 at 20:02
  • 1
    @box Correct, but my question was how to get this information from within my server, not in the app. Any idea? – XAnguera Feb 07 '18 at 16:30

2 Answers2

4

I just found this recently at this link https://developer.android.com/google/play/billing/billing_reference.html#billing-codes

Listed in the Billing Details API Reference section, there are extra fields in the response that only appear if there is an introductory price set. introductoryPrice for example gives a string like "$9.99". You can just check if that field is set, and if it is then there is an introductory rate available, you can also get things like the introductory price period and number of cycles it applies to.

JStephen
  • 1,059
  • 3
  • 13
  • 28
  • 1
    I confirm that it works. Pretty sure this information was absent before. One more trick. Your "google account" should be eligible for introductory price. Otherwise, you won't see any mentioning in response. In my case I had a account that we are using for testing. With that account subscription was purchased and canceled many times. I had to switch to a different account to see `introductoryPrice` in response. – MyDogTom Aug 11 '17 at 09:30
  • good catch, i have two accounts on my phone and didn't have that issue, it must have been using the account I somehow hadn't purchased with yet. I have made several purchases before and never really paid attention to which one was purchasing. – JStephen Aug 11 '17 at 13:48
  • 1
    @MyDogTom I have a problem, even if account isn't eligible for introductory price, introductoryPrice is present on SkuDetails. So in don't when to show the introPrice or not. – Rémy Mar 27 '19 at 15:20
  • @Rémy I'm having the same problem. Have you been able to figure out how to determine if a user is eligible for, or has received an introductory price? – saltandpepper Apr 16 '19 at 09:57
  • @saltandpepper i posted an answer – Rémy Apr 16 '19 at 12:54
  • For me the introductory price didn't show up at first. But after I ran `adb shell pm clear com.android.vending` and restarted the app it showed up. – Mikael Finstad Jun 09 '20 at 07:36
  • @MyDogTom can you please help me in showing introductory price ? – Tushar Pandey Jun 10 '21 at 04:57
  • 1
    @TusharPandey I suggest to open a new question with a concrete information about what problems you have – MyDogTom Jun 13 '21 at 07:01
3

Finally i used The getPurchaseHistory() method from In-app billing. This method returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.

So if the SKU isn't on this return, the intropricing is available.

Rémy
  • 313
  • 3
  • 17