Is there a way to check original app purchase?
melvitax opened this issue · 8 comments
I would like to move an app from fixed price to free with in app purchase. How can I check the original receipt of the app itself so I can unlock the in app purchase to all the users who paid for the app originally?
Full receipt introspection is not yet implemented in MerchantKit
. This is definitely something I want to flesh out in the future. If you are looking for an interim solution, you could copy paste the ASN1 parsing methods into your own project and decode the receipt yourself.
Thanks!
@melvitax I was wondering whether you've done that work in the meantime and would be able to share some of the steps needed as I've been struggling with this part! Thanks
Hey, check out Merchant.receiptMetadataTask()
on the latest release. This exposes the original application version.
Hi,
I wanted to do something similar to OP but I can't get Merchant.receiptMetadataTask()
to work.
When I run the following code:
let task = self.merchant.receiptMetadataTask()
task.start()
task.onCompletion = { result in
switch result {
case .success(let metadata):
print(metadata.originalApplicationVersion)
case .failure(let error):
print(error.localizedDescription)
}
}
The completion handler is never called. However, in the logs, I can see that the receipt was fetched successfully. Am I doing something wrong?
Did you try setting the completion handler before calling start()
?
That worked, I feel so stupid. Thanks for the quick help!