To retrieve a list of all purchased product IDs, you can use the getIapPackage() function. This method returns an ArrayList of SdkIapPackageDto, representing all the purchased products.
suspend fun getIapPackage(): ArrayList<SdkIapPackageDto>
suspend fun getAllPurchasedProducts() {
val purchasedPackages: ArrayList<SdkIapPackageDto> = IKUtils.getIapPackage()
purchasedPackages.forEach { packageDto ->
// Process each purchased package
}
}
//Kotlin wrapper:
import kotlinx.coroutines.runBlocking;
public fun getAllPurchasedProducts() : ArrayList<SdkIapPackageDto> = runBlocking {
IKUtils.getIapPackage()
}
//Java call:
ArrayList<SdkIapPackageDto> purchasedPackages = YourKotlinClass.INSTANCE.getAllPurchasedProducts();
for (SdkIapPackageDto packageDto : purchasedPackages) {
// Process each purchased package
}
Retrieving the price this way might be inaccurate. If the productID has more than one price, this function only fetches the first price it encounters, e.g., a Trial package might be fetched at $0. For most accurate results, use the method to retrieve full package details mentioned above.
This function retrieves the price of an in-app product specified by its productId. The price information is useful for displaying to users before they make a purchase decision.
fun getPricePurchase(
productId: String,
callback: IKBillingValueListener?
)
Parameters:
productId: String: The ID of the product you want to retrieve details for. This is typically defined in the Google Play Console as part of your in-app products or subscriptions.
This function retrieves the price of an subscription product specified by its productId. The price information is useful for displaying to users before they make a subscription decision.
fun getPriceSubscribe(
productId: String,
callback: IKBillingValueListener?
)
Parameters:
productId: String: The ID of the product you want to retrieve details for. This is typically defined in the Google Play Console as part of your in-app products or subscriptions.