I have integrated the google play billing library inside my application to make a subscription purchase. It works well. The user receives purchase confirmation mail from google. confirmation mail from google
The active subscription is also visible in the play store subscriptions screen. Active subscription showing in play store
In the play console, the order detail said the user was successfully charged for a subscription. However, It gets canceled instantly. play console order history
I also check purchase acknowledgment, it returns true on every purchase. Initially, I thought there would be a mistake in my code. So, I tried various billing libraries from Github. The problem persists. In the end, I replaced the entire google billing library with Revenue cat. Followed every step described on Revenue cat documents. Still, getting the same issue.
Is there anything that I am missing to implement or done incorrectly? please help me out. Thank you
code for fetching available products:
private fun fetchOffering(){
Purchases.sharedInstance.getOfferingsWith({ error ->
// An error occurred
handleBillingError(requireActivity(), error)
}) { offerings ->
offerings.current?.availablePackages?.takeUnless { it.isNullOrEmpty() }?.let {
// All packages from current offering
if (it.isNotEmpty()){
it.forEach { p: Package ->
offeringPackages.add(p)
}
isProductsAvailable = true
}
Log.d("RevenueCat", "fetchOffering: success: ${it.size}")
}
}
}
code for making purchase:
private fun makePurchase(pack:Package){
Purchases.sharedInstance.purchasePackageWith(
requireActivity(),
packageToPurchase = pack /* package from the fetched Offering*/,
onError = {error, userCancelled ->
Log.d("RevenueCat", "makePurchase: userCancelled: $userCancelled")
handleBillingError(requireActivity(), error)
},
onSuccess = { product, purchaserInfo ->
if (purchaserInfo.entitlements[REVENUE_ENTITLEMENT_ID_PRO]?.isActive == true) {
Log.d("RevenueCat", "makePurchase: success: ${product.originalJson} ")
afterPurchaseSuccessSetup()
}
})
}