Search code examples
in-app-purchaserevenuecat

How to know which mobile os of a product a user has subscribed to using RevenueCat?


I'm having trouble finding out the mobile OS of the item that the user subscribed to. What I'm trying to do is allow only subscription upgrades / downgrades to same os. (not allowed changing monthly subscription from ios to yearly subscription from android)

To explain the current set-up, I have mapped the same ids to one offering.

[offering: monthly]
ios: com.blah.products.monthly
android: com.blah.products.monthly

However, this approach seems to have no way of knowing which os subscription item the user has subscribed to.

response data:

{
    "allExpirationDates": {
      "com.blah.products.monthly": "2019-04-25T05:07:02Z",
      "com.blah.products.yearly": "2019-04-25T08:07:02Z"
    },
    "activeEntitlements": [
      "premium"
    ],
    "activeSubscriptions": [
      "com.blah.products.yearly"
    ],
    "expirationsForActiveEntitlements": {
      "premium": "2019-04-25T08:07:02Z"
    },
    "latestExpirationDate": "2019-04-25T08:07:02Z",
    "purchaseDatesForActiveEntitlements": {
      "premium": "2019-04-25T07:07:02Z"
    },
    "allPurchasedProductIdentifiers": [
      "com.blah.products.monthly",
      "com.blah.products.yearly"
    ]
  }

To achieve my goal, do I have to change the strategy to mapping different identities to one offering like this?

[offering: monthly]
ios: com.something.ios.monthly
android: com.something.android.monthly

Solution

  • The OS isn't returned in the API or SDK (yet). A workaround could be to change the product IDs in App Store Connect vs Play Billing so you can tell where a user is being billed from by looking at the product ID.

    A real fix for this is in the "Planned" stage of the public roadmap, which will include more information in the GET /subscribers endpoint: https://trello.com/c/ialNFe86/50-add-additional-subscription-details-to-api