In App Purchase Products not found
Asked Answered
G

4

9

I have created an app with bundle identifier

com.myapp

Now I added two In App Purchase items. Following are the product ids

com.myapp.product1

com.myapp.product2

Now when I fetch list of products, it does not show any product.

I use following code to load products list

  let request = SKProductsRequest(productIdentifiers: Set(remainingIds))
        request.delegate = self
        loadProductsRequests.append(LoadProductsRequestInfo(request: request, completion: completion))
        request.start()

The code works fine, If I use other project's product & bundle ids. But when I try for my project, it can't load list of products

It seems the issue is due to the structure of bundle identifier. Kindly help me.

Golden answered 23/3, 2017 at 3:33 Comment(1)
What is the status of your product identifiers? are they 'Ready to submit'? or 'Waiting for upload'?Candancecandela
M
18

Your code seems proper to request the products.

Make sure you have added your products with bundle ids and other required details under iTunes Connect application under in-app purchase category.

One more thing - Apple will not allow receiving the product list from in-app until you fill the forms under “Agreement tax and Banking” on iTunes connect.

Below is the code to receive the product list which may helpful to you.

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

        let count : Int = response.products.count
        if (count>0) {
            var validProducts = response.products
            var validProduct: SKProduct = response.products[0] as SKProduct

            if (validProduct.productIdentifier == self.product_id) {
                print(validProduct.localizedTitle)
                print(validProduct.localizedDescription)
                print(validProduct.price)
                buyProduct(product: validProduct);

            } else {
                print(validProduct.productIdentifier)
            }
        } else {
            print("nothing")
        }
    }

Here product_id = "com.myapp.product1" or "com.myapp.product2".

Also, enable the In-App purchase from Capabilities:

In-App Purchase

Myself answered 11/4, 2017 at 8:4 Comment(1)
This code doesn't work anymore... Sorry. EDIT: Apologies! It works, but not on real devices which is really weird. Any thoughts? (I've removed my downvote)Harijan
E
4

In case of In-app purchase you have to do the following:

Login into iTunes Connect

Click “Users and Roles” and add “sandbox tester” Details to test the app with dummy payment • Click on “Agreement tax and Banking” Check For contract Type ,add needed account info,Bank info and Tax info. • On the iTunes Connect homepage, click the “Manage Your Applications” link • In the top-right corner, click “Create New Application” • Fill out all the requested information for your app. When asked for your application binary, check the box indicating you will upload it later.

It may take a day for you to get your desired list of products.

Elfreda answered 23/3, 2017 at 6:31 Comment(3)
I have already gone through that procedure. That is not the issue.Golden
The issue is I am not getting products list in my app.Golden
I've had this exact problem, and it was due to the issue described in this answer (or a slight variation). I think the in-app purchase API is intentionally obtuse so it can't be manipulated. Though it seems odd from a developer's perspective, not having the "paperwork" correct for your account does cause the issue you're seeing. I know it's frustrating, but try going through everything in your account, your app setup, entitlements, etc. and see if there's a box you forgot to check or an agreement you didn't sign. The mysterious ways of Apple... 🙄Kilkenny
W
1

As silly as it is, after I fixed all the problems mentioned in other response, I found out I had a slightly different Bundle ID in my app and on the Appstore connect.

So make sure your Bundle id matches between App Store connect and you app.

Wildfowl answered 23/9, 2018 at 12:38 Comment(0)
H
1

Happened with me. Hours of debugging until I was convinced there was nothing wrong with code, bundle identifiers, Xcode profiles and bundle Ids.

What was happening was, I had recently renewed my Apple Developer membership and had not updated the paid-app contract. Once I did that, things were back to normal and my in-app-products were returned after SKProductsRequest

You can check this answer on their forum: The contract must be signed by you and Apple. This can keep the SKProductsRequest from validating the identifiers.

Hbeam answered 30/10, 2022 at 13:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.