Discussions

Ask a Question
Back to All

Ask to Buy

Hi, I am pretty new to IAP coding and have hit an issue regarding purchasing when the user has Ask to Buy on their device. I am not sure how to work the purchase. I use the following code to make the purchase:
func purchasePro(completion: @escaping (Bool) -> Void) {
Qonversion.purchase("pro") { result, error, cancelled in
guard error == nil else {
completion(false)
return
}
if cancelled {
//cancel
completion(false)
}
else {
print("Purchased Pro Monthly!")
self.setPremVersion(premiumVersionSet: false)
self.setProVersion(proVersionSet: true)
completion(true)
}
}
}

I get the following in the logs:
<SKPaymentQueue: 0x282770030>: Payment completed with error: Error Domain=ASDErrorDomain Code=1052 "Unhandled exception" UserInfo={NSUnderlyingError=0x282ba81e0 {Error Domain=AMSErrorDomain Code=511 "Family permission required" UserInfo={NSLocalizedDescription=Family permission required}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}
Failed to buy Pro

I would love some help on how I handle this error. Currently the user gets the Ask to Buy pop up but that's as far as it goes, the parent doesn't see the request.

Cheers