The following document states that some APIs in Storekit1 have been deprecated and that migration to Storekit2 is recommended, but I understand that Storekit2 only supports Swift.
I'm currently creating an iPhone app in Objective-C, but is there a way to implement APIs equivalent to Storekit2 using a different Objective-C API?
https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-18-release-notes#StoreKit
StoreKit
RSS for tagSupport in-app purchases and interactions with the App Store using StoreKit.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
iOS Storekit2 Appstore production environment, some user feedback in app purchase faliure, What our log records is StoreKitError.unknown,please How to solve problem, thanks
Hellow.
I have integrated the In-App Purchase feature into my app using StoreKit2.
I execute the product purchase request using Product.purchase(options:).
https://developer.apple.com/documentation/storekit/product/3791971-purchase
The development is complete, and testers are currently testing the app.
They are not using Xcode.
They are testing either with a sandbox test account by distributing the archive through debugging methods, or by downloading the app from TestFlight.
I would like to test the scenario where Product.purchase(options:) returns .pending on a sandbox test account or TestFlight.
I understand that Product.purchase(options:) returns .pending if the "Ask to Buy" option is enabled on a child account.
However, there is no "Ask to Buy" option in the sandbox test account settings.
When I test with a child account that has "Ask to Buy" enabled on TestFlight, Product.purchase(options:) does not return .pending but instead returns .userCancelled.
I am wondering how I can test the case where Product.purchase(options:) returns .pending in a sandbox test account or on TestFlight.
Thank you.
I am looking to move from paid app to fremium without upsetting my existing users. I see WWDC2022 session where new fields introduced in iOS 16 are used to extract original application version user used to purchase the app. While my app supports iOS 14 and above, I am willing to sacrifice iOS 14 and go iOS 15 and above as StoreKit2 requires iOS 15 at the minimum. The code below is however only valid for iOS 16. I need to know what is the best way out for iOS 15 devices if I am using StoreKit2? If it is not possible in StoreKit2, then how much is the work involved in original StoreKit API(because in that case I can handle for iOS 14 as well)?
When simulating a Storekit error like an invalid device verification or others of that type, should we finish a failed transaction? When I test with a storekit configuration file, all failed transactions persist after every restart. The Apple-provided sample code for storekit 2 has transactions finished only when they are successful.
Hi,
I've been reported, and I've experienced myself, extremely slow responses from StoreKit 2 on boot.
I can reproduce the issue quite consistently with the iPhone, sometimes Transaction.currentEntitlements hangs for minutes even after the device has attained full Internet access.
My app is a VPN client, so there's certainly a chicken-and-egg situation, but I'm performing a basic test without the in-app validation in the packet tunnel provider. The tunnel starts fine on boot (on-demand), whereas the app takes ages to return from AppTransaction.shared and Transaction.currentEntitlements.
I guess this is caused by some network call inside the framework (maybe spoiled by the on-demand VPN?), but with no timeout, exceptions, logging, or future-proof fallback (appStoreReceiptURL is deprecated), I'm poking in the dark. It goes without saying, keeping the users waiting minutes to be credited for their purchases is a no-go.
I still can't find a reasonable workaround, but the frustrating part is that StoreKit 2 was supposed to make these things straightforward. At times, it doesn't feel "ready" and I spend on it a lot of time that I'd rather invest in the product.
Does this sound familiar to anybody?
Thanks in advance
Davide
Topic:
App & System Services
SubTopic:
StoreKit
Hello everyone,
I’m hoping someone might help with auto-renewable subscription validation in Apple’s Sandbox environment. Here’s the situation:
My Setup:
I’ve configured three auto-renewable subscriptions in App Store Connect and generated an In-App Purchase key (with the correct Issuer ID and Key ID). (I also tried the App Store Connect API Keys)
I’m using Apple’s App Store Server API v2 endpoints (GET /inApps/v2/subscriptions/{originalTransactionId}/latest) to fetch the latest subscription status.
I’ve created several Sandbox test users (with fresh email addresses), signed out of old test accounts on my devices, and tested purchasing subscriptions anew.
What Works:
I am receiving valid Server Notifications from Apple (e.g. SUBSCRIBED, DID_RENEW) with the correct environment: "Sandbox" field.
My JWT generation appears to be correct because I’m no longer receiving 401 errors—only 404. That suggests Apple accepts the key and credentials.
My fallback logic attempts production first; if it sees a 404 or 410, it switches over to the Sandbox endpoint. This is exactly what Apple’s documentation recommends.
The Problem:
Whenever I query GET https://api.storekit-sandbox.itunes.apple.com/inApps/v2/subscriptions/{originalTransactionId}/latest using the originalTransactionId from Apple’s own Server Notification, Apple returns a 404 (indicating it can’t find that subscription).
This happens even though the subscription is active in Sandbox (I see notifications arriving for it).
I’ve tried adding a brief waiting period (2 seconds) before calling the Sandbox endpoint, but it consistently returns 404. I’ve also tried multiple retries over a longer timeframe without success.
I tested multiple fresh Sandbox test users, ensuring each one was signed in to the device’s App Store. After each new purchase, I still get the same 404.
Additional Checks:
These are definitely auto-renewable subscriptions, not non-renewing or consumable products.
I also tried calling GET /inApps/v2/subscriptions/{transactionId}/latest but I still see 404.
I tried everything mentioned above in production as I said to no avail:
GET https://api.storekit.itunes.apple.com/inApps/v2/subscriptions/{originalTransactionId}/latest
Hello,
Having bad times with Development Postback copies receival on our custom server.
Current setup:
App is configured to be advertised (https://developer.apple.com/documentation/adattributionkit/configuring-an-advertised-app)
AdAttributionKit - Opt in for Reengagement Postback Copies ✅
AdAttributionKit - Postback Copy URL ✅
AdAttributionKit - Ad Network Identifiers ✅
Configured backend https://{name}.com/.well-known/appattribution/report-attribution/ (POST) ✅
Devices with iOS 18.4 (with Postaback Development tool and AdAttribution developer mode Enabled)
Tried different Postback setup combinations, with different app builds (debug, release installed from xcode/testflight) and with AdAttribution developer mode Enabled/Disabled - doesn't make any difference.
Console log:
Found 0 postbacks eligible for transmission for environments:
Any advise is very much appreciated
I'm using my sandbox account to subscribed to something. I am now trying to open the subscribed item in Settings > Apple ID > Subscriptions > Click on the active sandbox subscription > Cannot Connect.
Has anyone else encountered this? How were you able to get around it?
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
Subscriptions
In-App Purchase
App Store Server Notifications
I just converted my App to Freemium, but the method is used to give user, that bought the App before it was free, access to the paid futures seems not to be working.
I am getting the original Purchase Date from the AppTransaction (https://developer.apple.com/documentation/storekit/apptransaction/originalpurchasedate) and comparing that to a set date where the App Model changed. In Test Flight this is working without any Problems but on the Live System, users that have purchased the App do not get access!
let shared = try await AppTransaction.refresh()
if case .verified(let appTransaction) = shared {
result(appTransaction.originalPurchaseDate.ISO8601Format()).
}
I am using flutter to develop the App and the result()... send the string back to the flutter side.
Here is the code of the Flutter side:
Future<void> restorePurchases() async {
SubscriptionProvider().updatePayment(PurchaseStatus.pending);
await InAppPurchase.instance.restorePurchases();
if (Platform.isIOS) {
DateTime changedToFreemium = DateTime.utc(2025, 4, 7, 11, 0, 0);
String? purchaseDateRaw = await IosFlutterChannel().getOriginalPurchaseDate();
if (kDebugMode) {
print("Purchase Date Raw: $purchaseDateRaw");
}
if (purchaseDateRaw != null) {
DateTime purchaseDate = DateTime.parse(purchaseDateRaw);
if (purchaseDate.isBefore(changedToFreemium)) {
if (kDebugMode) {
print("Restoring legacy purchases");
}
SubscriptionProvider().update(true, SubscriptionStatus.active, SubscriptionType.fs_lifetime);
} else {
if (kDebugMode) {
print("Not restoring legacy purchases");
}
}
}
}
SubscriptionProvider().updatePayment(PurchaseStatus.purchased);
}
Console Log when running in Test Environment:
flutter: Purchase Date Raw: 2013-08-01T07:00:00Z
flutter: Restoring legacy purchases
Thanks!
I'm adding my first in-app purchase to an app, and I'm finding the process incredibly frustrating.
Aside from the Apple Developer Documentation not being clear enough, and kind of glossing over the technical steps required (and their sample code being woefully inadequate), App Store Connect and the testing sandbox simply don't work as they say they do.
For example, in my app I've purchased the IAP and now I want to request a refund. I select the purchase, I choose a refund reason, and this page says, "To set up a test for approved refunds, select any refund reason on the refund request sheet, and submit the sheet. The App Store automatically approves the refund request in the testing environment."
Well, when I re-launch the app the purchase is still there. I can't request a refund again because it says this is a duplicate refund request, so it knows that the purchase has had a request, and it's supposed to have automatically refunded it, but it clearly hasn't.
So, I try clearing the purchase history via the Settings app > Developer > Sandbox Apple Account. Same thing. Purchase remains.
Try clearing purchase history in App Store Connect. Same thing.
How on Earth does anyone get an in-app purchase to work when the entire testing environment is so badly executed?
How do I get past this? The IAP is the last part of the app that needs to be implemented, and I've lost a week on this already.
Hello,
About a month ago me and my team allocated a sprint to migrate the App Store Server Notifications service and the StoreKit library from v1 to v2.
Once the implementation was completed, we started testing using the sandbox environment (which was supposed to provide greater stability and maturity in v2).
The testing session went well, we managed to test various scenarios without noticing any issue (successful payment, failed payment, renewal etc).
This week, before doing the production deployment, a final testing session was scheduled.
Out of nowhere, we started to encounter all kinds of strange behaviours such as:
StoreKit2 error (in Xcode)
Received error that does not have a corresponding StoreKit Error: Error Domain=ASDErrorDomain Code=825 "No transactions in response" UserInfo={NSDebugDescription=No transactions in response}
Purchase did not return a transaction: Error Domain=ASDErrorDomain Code=825 "No transactions in response" UserInfo={NSDebugDescription=No transactions in response}
In some cases the transaction id resulting from the payment was retuned "" or nil, causing our server to raise an exception.
Newly created sandbox account that was raising an error that says "there is already a subscription made on this apple id".
Delays in the payment processing
Today, without doing any code changes, we managed to test all the scenarios without encountering any issue.
Due to the oscillating experience we had in the sandbox environment, we are considering postponing the release and maintaining StoreKit 1 for now, but even in this case, the fact that App Store Connect does not offer the possibility of rolling back the Notification Service to v1, causes inconvenience.
Has anyone encountered something similar? Is migrating to v2 a good choice?
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
StoreKit Test
StoreKit
App Store Server Notifications
I am using StoreKit 2 for my products and noticed that users from Ukraine (for example) receive a wrong Product.displayPrice.
The App Store works with USD but shows the local currency UAH.
Any chance to display the correct currency (USD)?
Topic:
App & System Services
SubTopic:
StoreKit
Hi,
Currently, instead of using a real device and test account for in-app purchase testing, we are using Products.storekit with the Simulator.
Our app offers a subscription plan with a 3-day free trial.
We would like to simulate the following test scenarios:
User cancels the subscription within the 3-day free trial period.
User cancels the subscription after the 3-day free trial period.
However, in Xcode, under Debug > StoreKit > Manage Transactions..., we couldn’t find an option to simulate a subscription cancellation.
There is an option to refund the purchase, but we believe this is not the same as a cancellation.
Do you have any idea how we can simulate these two cases using Products.storekit and the Simulator?
Thanks in advance!
Hi,
I have a project in React Native, and I am using react-native-iap to load subscription products.
When I use Xcode to run my app in debug mode, it lists all my subscriptions, and I am able to subscribe successfully. However, the receipt I receive is not getting validated.
When I release the app on TestFlight, it does not list my subscriptions, and I am getting an empty array.
I am using the useIAP hook from react-native-iap to fetch the list of subscriptions.
Additionally, my app and subscriptions are not yet approved because the subscriptions are not being listed correctly.
I had a standalone python application (created with pyinstaller) which was working perfectly alone. This macOS application was created in VS. I later decided to improve the application by implementing some Swift features (Subscription Manager). This required me to write a brief Swift file (Subscription Management) in XCode which the Python file called on.
Python Standalone Application Calling Swift :
# Function to check if the user has a valid subscription
def check_subscription():
subscription_manager_path = "/Users/isseyyohannes/Library/Developer/Xcode/DerivedData/SubscriptionManager2-ezwjnnjruizvamaesqighyoxljmy/Build/Products/Debug/SubscriptionManager2" # Adjust path
try:
result = subprocess.run([subscription_manager_path], capture_output=True, text=True, check=True)
return "VALID_SUBSCRIPTION" in result.stdout # Return True if valid, False otherwise
except subprocess.CalledProcessError as e:
print(f"Error checking subscription: {e}")
return False # Return False if there's an issue
However, when I try to run xcrun altool --validate-app ... I get the following error message.
The error reads as follows
Running altool at path '/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Frameworks/AppStoreService.framework/Support/altool'...
2025-02-16 11:02:21.089 *** Error: Validation failed for '/Users/isseyyohannes/Desktop/ALGORA Performance.app'.
2025-02-16 11:02:21.089 *** Error: Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in ‘/Users/isseyyohannes/Desktop/ALGORA Performance.app’. Unable to validate your application. (-21017)
{
NSLocalizedDescription = "Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in \U2018/Users/isseyyohannes/Desktop/ALGORA Performance.app\U2019.";
NSLocalizedFailureReason = "Unable to validate your application.";
I located the Info.plist file which had everything correct (my Bundle ID, etc.) for the python file. I am successfully able to notarize the application, just having issues submitting it.
**It is worth noting I currently have a python executable calling on a file written in swift code and created in xcode.
I created the python application with the following command on VS.
pyinstaller --onefile --noconsole \
--icon="/Users/isseyyohannes/Downloads/E0BWowfbDkzEiEAckjsHAsYMzpdjjttT.icns" \
--codesign-identity "Developer ID Application: Issey Yohannes (GL5BCCW69X)" \
--add-binary="/Users/isseyyohannes/Library/Developer/Xcode/DerivedData/SubscriptionManager2-ezwjnnjruizvamaesqighyoxljmy/Build/Products/Debug/SubscriptionManager2:." \
--osx-bundle-identifier com.algora1 \
/Users/isseyyohannes/Desktop/ALGORA\ Performance.py
Note : All steps on Apple Developer site are done (ex. Creating identifier, secret password etc)
Testing recurring subscriptions in a new release in both development environment and in Test Flight, we see an increased percentage of failed calls returning from Apple server. The return failure message is that an unknown error occurred.
The behavior is not consistent and most often we get a failure and another attempt succeeds. We do get around 50% failures which is alarming and cannot be explained to the end user.
We have also experimented with previous test versions that are in production currently and we see the same behavior, so this is not isolated to the most recent release we plan nor to a specific application we have. Past testing in previous releases did not return such high percentage of failures from Apple server.
Have you encountered such an issue? We have no idea what may cause Apple server to return with this "Unknown error" and there is no log we can consume from Apple subscription service.
Appreciate your help on this.
Hello everyone,
I want to set up subscriptions but I'm having problems testing them.
Indeed, when I use the storekit file to view the subscriptions it works, I see the subscriptions and I can subscribe in XCODE mode.
However, I'd like to go further and test with server notifications. So I removed the storekit file from the scheme, but I can't retrieve the products.
The application doesn't retrieve any products.. I've been stuck on it for 2 weeks... I checked the contracts and put in all the information last Friday and everything is validated.
I tested it in testflight mode, and it doesn't recognize any products!
Just so you know, I use the original API for maximum compatibility.
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
App Store
StoreKit
In-App Purchase
App Store Receipts
I remember when I called Apple Support, they told me that they can only assist with refunds for orders within the last two months.
Topic:
App & System Services
SubTopic:
StoreKit
I am testing sandbox subscribe but I always recieve DID_FAIL_TO_RENEW
I try to create new sandbox account and clear purchase history but not work
can anyone help?