WICG / digital-goods

Other
50 stars 28 forks source link

Does getDetails need to take ItemType? #3

Closed mgiuca closed 4 years ago

mgiuca commented 4 years ago

Our original design included an ItemType parameter to getDetails:

Promise<sequence<ItemDetails>> getDetails(sequence<ItemId> itemIds, ItemType type);

enum ItemType {
  "one_time",
  "subscription",
};

This was modeled off the Android BillingClient.querySkuDetailsAsync method; the ItemType enum is based off of the BillingClient.SkuType enum.

This parameter is used to decide whether you're querying for one-time or subscription items.

It feels wrong to require this in our generalized interface, since the itemIds should know what type of item they are (this shouldn't be an input to the query method). It's especially weird that the method takes a list of item IDs, but only a single item type, which means you can only query for N one-time items or N subscription items, not a mixture of both.

However, we may not be able to interface with the Android BillingClient library unless we take this parameter. For now, it is omitted from the design. We might add it back as an optional parameter passed through an optional dictionary.

phoglenix commented 4 years ago

Peter checked in the Android/Play billing and got an error when trying to create an item of different type with the same ID, so (thankfully) ID is a unique identifier and we can omit ItemType. Hopefully other billing backends are similarly sane.