cafebazaar / Poolakey

Android In-App Billing SDK for Cafe Bazaar App Store
Apache License 2.0
71 stars 22 forks source link

how to get user has purchased product? #68

Closed dev95code closed 2 years ago

dev95code commented 2 years ago

Hi I created an application and want to get that user has purchased product or not, what's the method to do that? I tried getPurchasedProducts() but it returns an empty success response.

msmoradi commented 2 years ago

Hi This feature does not exist currently and the getPurchasedProducts function returns the information of in-App products purchased by the user. for more info, you can read this document.

dev95code commented 2 years ago

according to your code that returns user's purchases, I placed my product's ID instead of your skuValueInput.text.toString() but this piece of code is called: toast(R.string.general_user_did_not_purchased_item_message). Note that I had purchased product and it has no problem in previous sdk (TrivialDrive sdk).

private fun handlePurchaseQueryCallback(): PurchaseQueryCallback.() -> Unit = { querySucceed { purchasedItems -> val productId = skuValueInput.text.toString() purchasedItems.find { it.productId == productId } ?.also { toast(R.string.general_user_purchased_item_message) } ?: run { toast(R.string.general_user_did_not_purchased_item_message) } } queryFailed { toast(R.string.general_query_purchased_items_failed_message) } }

msmoradi commented 2 years ago

In fact, we tested these functions and they worked fine. Note that this function just returns not consumed user purchases, If you have consumed the purchase in the past, you will not receive it now. If there is still a problem, you can contact developer support for better guidance.

Email developers@cafebazaar.ir Phone 021-91009798