pableiros
pableiros

Reputation: 16032

StoreKit 2 - Product request always empty

I'm trying to fetch the products from the App Store Connect using StoreKit 2 but always returns an empty array:

let keys = [
    "com.app.suscripcion.mes.1"
]
        
let storeProducts = try await Product.products(for: keys)

I had added a key on the InApp Purchase section:

enter image description here

What do I have to do to fetch the products from the App Store Connect? If I use a .storekit configuration file it works but with a real scenario doesn't work

Upvotes: 11

Views: 4330

Answers (3)

mintymuz
mintymuz

Reputation: 357

Make sure you're passing the identifier of the Product or Subscription in this method and not the app's bundle identifier by mistake:

try await Product.products(for: ["my_monthly_subscription"])

try await Product.products(for: ["com.mycompany.myapp"])

Upvotes: 2

pableiros
pableiros

Reputation: 16032

To solve this problem, the Account Holder from App Store Connect, inside Agreements, Tax, and Banking, needs to Set Up Tax and Banking to Paid Apps in order to get the InApp Purchase products from App Store Connect:

enter image description here

After that, the Status for the Paid Apps Type need to change to Active in order to make it work.

Upvotes: 17

dn.Jung
dn.Jung

Reputation: 49

Check if the StoreKit Configuration value is set to none in the options of the scheme that was executed.

Upvotes: 4

Related Questions