Question

Android Subscription - Adding Base Plan ID to product Id?

  • 29 March 2023
  • 5 replies
  • 228 views

Userlevel 1
Badge +7

Hello,

When I purchase an android subscription (renewing 1mo) it seems that in the response webhook I am getting the product_id: product_identifier:base_plan_id. Before I was just getting the product_id which corresponded to whatever product_identifier I set on the google play store. How can I fix this so that the product_id coming from the webhooks does not append the base_plan_id? 

Thanks,
Carl


5 replies

Userlevel 3
Badge +7

Hi Carl,

This is due to support we recently rolled out for Google’s new subscription model, which you can learn more about here.

For Google products that were created recently, their product identifiers will be of the format you mentioned, which can be seen in the dashboard. This is due to the new ability to have one subscription product, with multiple base plans - hence the need for the new format.

Badge +1

Hello! I have a follow-up question on this topic. I understand the reasoning for representing the subscription and base plan combination in the product ID. Why is this only on the webhooks though?

Using the SDK (React Native) I am still getting the old-style product ID (no base plan).

Similarly if I call the RevenueCat API to look at a subscriber I am getting the product ID with no base plan.

Just wondering what the reason is for this to be inconsistent. Thank you!

Badge +6

I am just working on converting to Google’s new subscription model and there seems to be a whole mix of different ID’s between what the SDK (in my case purchases-capacitor) gives and what the REST API  v1 gives. It would be nice if all these different Ids were documented somewhere.

 

The REST API for /v1/subscribers/{app_user_id} returns:

  • entitlements.{id}.product_identifier = Subscription_Product_Id
  • entitlements.{id}.product_plan_identifier = Base_Plan_Id

product_plan_identifier isn’t actually documented here.

 

For the SDK getOfferings we have the following IDs:

  • current.{plan}.product.defaultOption.id = Base_Plan_Id
  • current.{plan}.product.defaultOption.storeProductId = Subscription_Product_Id:Base_Plan_Id
  • current.{plan}.product.defaultOption.productId = Subscription_Product_Id
  • current.{plan}.product.identifier = Subscription_Product_Id:Base_Plan_Id

 

In the SDK getCustomerInfo we have:

  • activeSubscriptions = Subscription_Product_Id:Base_Plan_Id
  • entitlements.active.{id}.productIdentifier = Subscription_Product_Id
Badge +1

Is it safe going forward to access `current.{plan}.product.defaultOption.productId` when on Android, and treat that as the product identifier? It seems to be the only way to get consistency - passing `product.identifier` to `getProducts` fails when the format is `Subscription_Product_Id:Base_Plan_Id`. It requres us to pass only the `Subscription_Product_Id`.

for IOS  defalutoptions are coming as null "defaultOption":null,  for subscriptions

Reply