Bartu Akman
Bartu Akman

Reputation: 195

How can I know user has in-app purchases item in store?

Hello guys, I'm try to check user has a in-app purchase item. But I couldn't figured out this function what it does ? Am I need that or another function ı have to implemented I am so confused. Please someone explain clearly what is going on here

extension IAPService: SKProductsRequestDelegate {

   func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse)    {

    self.products = response.products
    if response.products.count == 0 {

}

    }
    }

Upvotes: 0

Views: 107

Answers (1)

enc_life
enc_life

Reputation: 5169

To see what products the user has purchased you have to check the receipt file. The function you shared is to fetch all the products available for purchase from the App Store.

The receipt file contains all the info you need, but there's no direct system APIs to see it's contents. There are various ways to check a receipt file for purchased products and it is usually a tradeoff between security and development complexity. In an ideal scenario you have a server unpacks the receipt securely and saves the correct purchase info on the user.

Here's a blog post that covers the receipt file in more detail: Dissecting an App Store Receipt

Upvotes: 1

Related Questions