Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BillingClient Purchase.getProducts() returns multiple identifiers

Previously, to get the product id, the getSku() method was used, which returned singular value.

In the 4.0.0 version of the BillingClient library, the getSkus() method was added (https://developer.android.com/google/play/billing/release-notes#4-0)

In version 5.0.0, the getSku() method was removed totally, and getSkus() was replaced with getProducts(), whose documentation says just “Returns the product Ids.” (https://developer.android.google.cn/reference/com/android/billingclient/api/Purchase?hl=zh-cn#getProducts())

I cant google any information, why product can have multiple identifiers now?

like image 241
AseN Avatar asked Aug 15 '26 23:08

AseN


1 Answers

Since v5.0.0 BillingFlowParams.Builder has setProductDetailsParamsList() method which indicates there can be multiple products included within one purchase, so to be consistent with this Purchase has the getProducts() method which returns a list.

(The sample code uses ImmutableList but with only a single item: https://developer.android.com/google/play/billing/integrate#launch)

like image 199
mlebedy Avatar answered Aug 17 '26 13:08

mlebedy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!