Solved

Unexpected identifier structure with RC 5.0.0-beta.1 on Flutter / Android

  • 18 April 2023
  • 6 replies
  • 91 views

Badge +6
  • Active Member
  • 11 replies

Hi all,

I am currently playing around with the changes that come with billing client 5 implemented in the RevenueCat Flutter SDK version 5.0.0-beta.1, and I am getting an unexpected identifier on the StoreProducts:

List<String> products = ['subscription_annual'];

List<StoreProduct> storeProducts = [
...await Purchases.getProducts(products, productType: ProductType.subs),
...await Purchases.getProducts(products, productType: ProductType.inapp),
];

for (StoreProduct e in storeProducts) {
print(e.identifier); // Prints subscription_annual:p1y
}

I would expect the identifier to be identical to the product that I am retrieving from Google Play, but it appears it defaults to something like product:basePlanId. The defaultOption and subscriptionOptions appear to be correct: productId has the product, storeProductId has the product:basePlanId.

Am I missing something?

What would it look like if I had multiple base plans? Would I receive multiple StoreProducts from RevenueCat or would I get a neutral identifier?

Thanks for clarifying.

icon

Best answer by MarcosC 19 April 2023, 21:21

View original

6 replies

Userlevel 4
Badge +6

Hey @Matt ,

 

This is related to the new changes in using the new subscription model for Google. We have some more information on migrating to help smooth out the process which could be found here: https://www.revenuecat.com/docs/android-native-5x-to-6x-migration

 

The entitlements, offerings and packages of your dashboard should remain the same during this change. With the new configuration options, there could be multiple offers available when purchasing a Package or StoreProduct. When purchasing a Package or Product, the SDK will choose which option to purchase as the "default offer", mimicking how it worked on previous versions of our SDK. If you want more control, you can instead purchase a SubscriptionOption directly. For more information, check out this guide

 

This visual here could help better explain how things are referred to with the new changes: 

 

Let me know if this helps! 

Badge +6

Hi @Michael Fogel ,

Thanks for sharing these details, shower I'm afraid it does not answer my question at all. My question is related specifically to the identifier of the Store product, and not the overall behavior with respect to the latest billing client.

 

Userlevel 3
Badge +6

Hi @Matt 

 

The StoreProduct on the SDK represents a base plan within a subscription. When calling `getProducts(products,...)`, we fetch all the subscription that you provide as parameter and return a list of StoreProducts, each store product being a base plan within that subcription.

> What would it look like if I had multiple base plans? Would I receive multiple StoreProducts from RevenueCat or would I get a neutral identifier?

Yes, you would get multiple StoreProducts and the identifier for them would be `subscriptionid:baseplanid`

Badge +6

Thank you for the quick explanation. If that's how it works, then that's how it works. Would that still mean that every StoreProduct would contain all base plans as SubscriptionOption, or would they always just list one? Because that would appear to defeat the purpose of having the list of SubscriptionOptions in the first place...

Userlevel 3
Badge +6

SubscriptionOptions would have the base plan and all the offers attached to that base plan.

 

What was your expectations (so I can share this to my team and we can discuss it)? In RevenueCat, we are mapping a Product to a  Subscriptions base plan, that’s the main reason why we made the same mapping on the SDK.

Badge +6

Hm, I think what you are describing makes sense.... Let me review again and check were I might have taken a wrong turn in my logic....

Reply