purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

Add the type to Product

Open rocboronat opened this issue 3 years ago • 7 comments

It would be handy to have the type of the Product in the Product type. I know I could deduce it because I load them with Purchases.getProducts(ids, type: PurchaseType.subs) or Purchases.getProducts(ids, type: PurchaseType.inapp), but you could too. Having to wrap your product just to add this field is not that clean.

rocboronat avatar Feb 12 '22 07:02 rocboronat

@rocboronat I feel your pain.

This is harder to get right than you'd expect, though, because the APIs for it aren't great.

For example, Apple's SKProduct doesn't have a field for it.

We can somewhat use the existence of a subscriptionPeriod to figure out whether a product is a subscription or not, but granularity for "is this a consumable or lifetime" wouldn't be possible with that implementation. We would also not be able to distinguish an auto-renewable from a non-auto-renewable subscription, either.

So the most we could do would be "subscription" or "nonSubscription". Or isSubscription, for that matter.

We're working on moving to using StoreKit 2 under the hood, which would allow us to provide a detailed type, with values like consumable, nonConsumable, nonRenewable, autoRenewable.

On Google's side, things are tricky too.

Google has no concept of "consumable" vs "non-consumable", rather, it's how you use it. I.e.: if you consume a product, it becomes a consumable.

So we'd again only be able to provide something like "subscription" vs "non-subscription".

I think that could still be valuable, though. I'm going to bring this up with the team.

aboedo avatar Feb 14 '22 15:02 aboedo

Oh, I'm moving the conversation to your own issue, as I see you ask there for my feedback. Thank you so much for moving it, @aboedo and @beylmk 👍

rocboronat avatar Feb 15 '22 09:02 rocboronat

Oh, I just saw the issue was on the iOS implementation, not the flutter one 😅

My opinion is there, but let's have this issue open, just not to forget it in case the iOS one moves forward.

rocboronat avatar Feb 15 '22 09:02 rocboronat

Hello! It doesn't seem like we have quite enough information to send this to a human yet to help out. We would love if you could provide more details about your issue by following the template without modifying any of the pre-filled text. If you're looking for support, head over to our Community.

ghost avatar Feb 15 '22 09:02 ghost

Bot, behave 😝

rocboronat avatar Feb 15 '22 09:02 rocboronat

haha sorry about the bot!

Sounds good! We can keep this one around until the iOS changes get propagated to our flutter SDK too.

Thanks for opening @rocboronat!

aboedo avatar Feb 15 '22 12:02 aboedo

iOS portion completed -- see https://github.com/RevenueCat/purchases-ios/issues/1295

We can keep this ticket open for the Flutter implementation

beylmk avatar Feb 17 '22 18:02 beylmk