StoreKit 2 - Product request always empty - ios

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:
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

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:
After that, the Status for the Paid Apps Type need to change to Active in order to make it work.

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

Related

Removing item from in-app-purchase [Cleared For Sale = NO] still appears in app

I'm doing testing on IAP and was trying to test the scenario whereby I have a list of items for sale. eg:
in the App (V1)
public static let productIdentifiers: Set<ProductIdentifier> = [
coins.coins100,
coins.coins200,
coins.coins300
]
I also have this same set of productIdentifiers set up in AppStoreConnect.
Now lets say, 1 month later I decide to pull 1 of the IAP from sale. Let's call it version 2
in App (V2)
public static let productIdentifiers: Set<ProductIdentifier> = [
// coins.coins100,
coins.coins200,
coins.coins300
]
and within AppStoreConnect I deselect the "Cleared for Sale"
Now during testing.
For Version 2, where I only have 200coins and 300coins in the app being sent to Apple, there's no issue, I end up with the expected 2 products returned for IAP.
But what about version 1 apps? When I tried it, seems like all 3 products is still returned from Apple. (note: Cleared for sale is removed)
The users on version 1 seems to still be able to purchase the 100coins IAP? Is this expected behaviour?
Note : This is a consumable product if it matters.
Cleared for Sale
Indicates whether your In-App Purchase is cleared for sale or not. If
this box is unchecked, your In-App Purchase will not be available for
purchase from within the app. Note that if you set Cleared for Sale to
No, all settings for the In-App Purchase will still be available to
edit in iTunes Connect, and you can change Cleared for Sale to Yes at
a later date.
No in version1 there should be only 2 IAP's because if you uncheck Cleared for Sale option under Availability it means that you don't want to let the user purchase this offer.
However, if you are testing in debug mode in the Sandbox environment then I might return 3 products just because three are listed in your app store connect account check this answer.
you can submit IAP for review so that apple review can check metadata by Unchecking Cleared for Sale. even if your metadata is approved by the Apple review team and IAP status is ready still you can't see this IAP in the list when you are testing in release mode. It will only be available when you check Cleared for sale option.

Unable to submit app for external review even though privacy policy url available on itunes connection

I am trying to submit my app for Test Flight beta testing, while submitting is is showing error saying
"Apps that use the entitlements [com.apple.developer.in-app-payments] must have a privacy policy for [English]. If your app doesn’t use these entitlements, remove them from your app and upload a new binary."
I have already updated privacy policy link in
TestFlight->Test Information -> Privacy Policy URL
AppStore->App Information -> Privacy Policy URL
FYI, I did not yet updated in Marketing URL in Test Information & I am using Apple pay in my App.
Please let me know what I am missing or where am I missing anything.
Thanks
If you use In-app Payments you need to disclose so in your Privacy Policy -- even if that's the only thing you use in your app.
To fix this, you need to:
Create a Privacy Policy on your website (or any other public page where you can host your policy)
Disclose in your Privacy Policy that you use in-app payments and that Apple is responsible for payments
Provide the URL to your Privacy Policy in iTunes Connect
Some few examples that might help you:
WeatherBug clause:
Calm policy:
Please See this - https://developer.apple.com/support/itunes-connect/#//apple_ref/doc/uid/TP40013727-CH33-SW19
In iTunes connect, you need to go to your product and set it to Remove from Sale. You can then delete it.
Also, In Your Project --> Target --> Capabilities --> Turn In App purchases to off.
Removing Products from Sale You can choose to stop an In-App Purchase product from being sold in an app. If you do, the In-App Purchase product remains in iTunes Connect.
Important: Removing a product from sale prevents auto-renewable subscriptions from renewing, but it doesn’t keep users from being able
to restore products that they purchased previously. bullet
Deleting Products You can delete In-App Purchase products after they’re created, but not if they’re In Review. To delete a product after it is available for sale, you must first remove it from sale.
Important: After you delete an In-App Purchase product, it’s no longer
available on iTunes Connect and it can’t be restored. The product ID
can’t be reused for another In-App Purchase product.
The following approach has resolved my issue.
I was in an impression that [com.apple.developer.in-app-payments] is needed for Apple pay, but when I removed [com.apple.developer.in-app-payments]/Merchant IDs from entitlements file, the Apple pay still works, & build is able to submit for external tester/review
Now the conclusion is that both in-app-payments & Apple pay in Application is totally different

iOS: In-App Purchase

I have implemented in app purchase in my application with multiple products and my application is live now.
As i have created multiple products there organization id is eg. com.abc.product1, com.abc.product2 and so on and i have assigned that number according to the id i have received from web service response.
In my Xcode application i have assigned product identifier as com.abc.product and i am attaching that number dynamically to that identifier.
If i have more products to add in the application then i will create in-app products in iTunes connect.
So my question is i need to create new build for those products or i have to just create products and submit those for review.
If you initial app is approved and live, you don't need to create new Build to submit additional in-app purchases.
You can submit them at any time and submit in bulk as well. See below link for instruction on setting them up
https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/SubmittingInAppPurchases.html
You can continue with this approach. But make sure that you are validating the product identifier with itunes first before showing it to the user, just to make sure that the identifier formed at client side is available at itunes also.

iOS in app purchase. How to check if purchase already bought?

I'm trying to add purchases to my application. But I don't know how to check if purchase is already bought. As far as I understand when somebody bought purchase I need to store this into UserDefaults or KeyChain and then check if it is already there (it mean that this purchase is already bought). But what about when user bought this purchase prom another device?
I have code that give me information about all purchases in iTunes.
func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {
}
Response object have two variables: "products" and "invalidProductIdentifiers". But as I understand products contain all products from iTunes and invalidProductIdentifiers contain all identifiers that I was asking to check for but Apple can't recognise them. So where I can check if purchase was already bought or not.
Assuming iOS 7+, you should be validating the receipt, ala A complete solution to LOCALLY validate an in-app receipts and bundle receipts on iOS 7 to determine what's purchased, what's valid (in the case of subscriptions or consumables), and as noted in the other comment, offer a "Restore Purchases" UI element which allows users to cleanly propagate sharable purchases to a newly restored/acquired device.
AFA the response object, that is catalog (purchasable items) information, not info on what has been purchased. In order to have IAP work correctly, assets are to be approved by Apple similarly to the app itself as well as being under "ready for sale" control of your own in iTunes Connect. For that pass, you send Apple a complete list of the times you want to offer and Apple returns to you the list split into the "if your user tries to buy this, they will succeed" (the products) and "if your user tries to buy this, they will fail" (the invalidProductIdentifiers).
When you're testing with sandbox/iTunes Connect Test users, your products do not need to be approved by Apple, but for production code they do.

new In app purchases product for current app

I am working on in app purchases for content downloading.
Product list will return from the server and product id also. I am not clear about one thing:
Can I add new in app purchases without updating the app ? Because the product list will come from server side.
I just want to add In App Purchases from iTunesConnect and the product list on the server side.
Yes you can add new in app purchases without update the app.
You will need to add all of your product to iTunes connect & for sure get Apple approval.
When you return product like reten it with same IAP ID.

Resources