Search Unity

Android Subscriptions - Introductory pricing support

Discussion in 'Unity IAP' started by gianfanatee, Apr 10, 2018.

  1. gianfanatee

    gianfanatee

    Joined:
    Jun 14, 2016
    Posts:
    13
    Hi there, Unity Team,

    I have subscriptions in my game already working, but would like to add a new subscription with an introductory pricing. Basically, Google Play allows subscriptions to be created which have a cheaper price during the initial N days/weeks/months/etc.
    Ex: Pay $1.99 for the first three months, and then $3.99 the following months.
    (More info at https://developer.android.com/google/play/billing/billing_subscriptions.html#intro and https://support.google.com/googleplay/android-developer/answer/140504?hl=en#intro)

    When retrieving the SKUs from Google, there are several sku details provided by Google, but which Unity does not expose. A few examples are: introductoryPrice, introductoryPricePeriod, introductoryPriceCycles, ...
    (For all skuDetails, check https://developer.android.com/google/play/billing/billing_reference.html#getSkuDetails)

    Digging a bit deeper, I'm under the impression that Unity, when retrieving the products, does not save those values. The json with the values is saved in the android-specific code, but when sending them to Unity, the data is parsed to only send the default cross-platform Product object.

    I have not been able to find any way to access the needed information. Even access to the raw json would be enough. Seeing as Android has this since 2006, I'd expect it to be implemented. Hopefully, now that Apple has added introductory pricing to the App Store, this might get put on fast track.

    Anywho, is there any solution or workaround for my problem? I need to access the raw skuDetails for subscriptions. Would implementing a IStoreExtension help? The only workaround I can think about is monkey patching the Unity IAP, which sounds like a horrible idea.

    Thanks,
     
    MorenoBralts likes this.
  2. gianfanatee

    gianfanatee

    Joined:
    Jun 14, 2016
    Posts:
    13
    Is there any way to read the raw JSON response from google?
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This is a feature we are looking to add in a future release, hopefully soon.
     
  4. gianfanatee

    gianfanatee

    Joined:
    Jun 14, 2016
    Posts:
    13
    How are we, in regards to this? Seeing as Unity already retrieves this data but simply does not expose it to the users, wouldn't it be a simple fix to start doing so?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  6. MohHeader

    MohHeader

    Joined:
    Aug 12, 2015
    Posts:
    41
    @JeffDUnity3D
    I found that to get this type of data I need to have a valid ( receipt )
    But in my case, I need to show the introductory price in the UI, even before the user bought it, so I have no valid receipt yet.

    Any thoughts about it ?

    I was able to get that type of data for iOS, using the following code
    Code (CSharp):
    1. extensions.GetExtension<IAppleExtensions>().GetIntroductoryPriceDictionary();
    But can't find anything similar for Android,
    even
    Code (CSharp):
    1. extensions.GetExtension<IGooglePlayStoreExtensions>().GetProductJSONDictionary()
    is retuning null

    Thanks
     
  7. arnaldoGaroto

    arnaldoGaroto

    Joined:
    Feb 3, 2013
    Posts:
    22
    was this fixed?
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We have released Unity IAP 2.2.1 https://forum.unity.com/threads/uni...1-is-now-available.415517/page-2#post-6528995

    and should fix this issue. From the release notes:

    ### Added
    - GooglePlay - Subscription metadata is now available in `GoogleProductMetadata` from `ProductMetadata.GetGoogleProductMetadata()` via `IStoreController.products`.
    - For example, use `GoogleProductMetadata googleMetadata = storeController.product.all[0].metadata.GetGoogleProductMetadata();` now instead of the deprecated, `IGooglePlayStoreExtensions.GetProductJSONDictionary`.
    - string originalJson - Note, a single SkuDetails JSON, instead of multiple from `GetProductJSONDictionary`
    - string subscriptionPeriod
    - string freeTrialPeriod
    - string introductoryPrice
    - string introductoryPricePeriod
    - int introductoryPriceCycles
     
  9. arnaldoGaroto

    arnaldoGaroto

    Joined:
    Feb 3, 2013
    Posts:
    22