I noticed a very weird behavior for refunds. When a user refunds an up-front paid app, they still have access to the app. How can I detect such a case and block access to the app?
In general, I think it should be handled by Apple, but for some reason, they don't do it.
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
I had a two CS from customers that they couldn't buy a cookies(IAP). they got an alert "Purchases in this app are already purchased items."
I was wondering if anyone has any similar experiences.
Topic:
App & System Services
SubTopic:
StoreKit
Hi Apple Developer Team,
I'm looking to confirm some technical details regarding the pre-order flow and App Store receipt handling. Specifically, I have the following questions:
Q1: After a user installs an app via pre-order and launches it for the first time, will a valid App Store receipt be available immediately via [[NSBundle mainBundle] appStoreReceiptURL]? Are there any known cases where the receipt might be missing or invalid, requiring a manual refresh (e.g., via SKReceiptRefreshRequest)?
Q2: Is the pre-order flow currently supported in the sandbox environment? Specifically, is it possible to simulate pre-ordering an app and installing it in a sandbox or TestFlight environment, in order to test receipt generation and related logic?
https://developer.apple.com/documentation/appstorereceipts/responsebody/receipt
Q3: The receipt field in the App Store receipt structure is marked as deprecated. Is it still acceptable to use this field for validating receipts? Has Apple announced any timeline or system version in which this field will be fully removed or unsupported?
After downloading Backyard Birds and following the steps in the section "Configure the sample code project" (i.e. enabling local StoreKit testing in the scheme).
When I run the macOS app from within XCode, the following error occurs.
Whenever I try to purchase any item from within the app, I am presented with the following error dialogue:
"Couldn’t communicate with a helper application. Try your operation again. If that fails, quit and relaunch the application and try again."
This happens after I click the purchase button (i.e. the button that displays the price).
The Xcode logs show the following errors:
Error handling payment sheet request: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated from this process." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated from this process.}
Type: Error | Timestamp: 2025-09-26 18:05:36.214491+02:00 | Process: Backyard Birds | Library: StoreKit | Subsystem: com.apple.storekit | Category: Default | TID: 0xafed
followed by
Purchase did not return a transaction: Error Domain=ASDErrorDomain Code=5115 "Received failure in response from Xcode" UserInfo={NSDebugDescription=Received failure in response from Xcode, NSUnderlyingError=0x600001545470 {Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated from this process." UserInfo={AMSDescription=Ein unbekannter Fehler ist aufgetreten. Versuche es erneut., AMSURL=http://localhost:49244/WebObjects/MZBuy.woa/wa/inAppBuy, NSDebugDescription=The connection to service created from an endpoint was invalidated from this process., AMSStatusCode=200, AMSServerPayload={
"app-list" = (
);
dialog = {
cancelButtonString = Cancel;
defaultButton = Buy;
explanation = "Do you want to buy one Box of Nutrition Pellets for $3.99?\n\n[Environment: Xcode]";
initialCheckboxValue = 1;
"m-allowed" = 0;
message = "Confirm Your In-App Purchase";
okButtonAction = {
buyParams = "bid=com.example.apple-samplecode.Backyard-BirdsHQN4U5V5MY&bvrs=1.0&offerName=pellet.box&quantity=1&deviceVerification=0aee9116-fef7-5d20-b21b-b28848615717&storekitViewInitiated=true";
itemName = "pellet.box";
kind = Buy;
};
okButtonString = Buy;
paymentSheetInfo = {
caseControl = true;
confirmationTitle = Pay;
countryCode = US;
currency = USD;
designVersion = 2;
displayPrice = "$3.99";
flexList = (
{
value = (
{
style = priceMain;
value = "$3.99";
},
{
style = priceSub;
value = "One-time charge";
}
);
},
{
header = "$null";
value = "For testing purposes only. You will not be charged for confirming this purchase.";
}
);
price = "3.99";
requestor = AppStore;
salableIcon = "http://localhost:49244/StoreKit/AppIcon?bid=com.example.apple-samplecode.Backyard-BirdsHQN4U5V5MY";
salableIconType = app;
salableInfo = (
"Box of Nutrition Pellets %%image_0%%",
"Backyard Birds",
"In-App Purchase"
);
styles = (
{
bold = true;
name = priceMain;
size = large;
},
{
color = gray;
name = priceSub;
},
{
bold = true;
name = priceMainSpaceBefore;
size = large;
spacingBefore = medium;
}
);
title = {
type = text;
value = Xcode;
};
};
};
"download-queue-item-count" = 0;
dsid = 17322632127;
failureType = 5115;
jingleAction = inAppBuy;
jingleDocType = inAppSuccess;
pings = (
);
}}}}
Type: Error | Timestamp: 2025-09-26 18:05:36.346918+02:00 | Process: Backyard Birds | Library: StoreKit | Subsystem: com.apple.storekit | Category: Default | TID: 0xafea
I am running
Xcode Version 26.0.1 (17A400)
macOS Sequia 15.7
What I have tried so far:
created a new admin user, logged in as that user, installed Xcode and ran the Backyard Bird sample from there. Same error.
This also happens with my own app, when I am trying to test purchasing.
How can I further debug this problem?
Topic:
App & System Services
SubTopic:
StoreKit
The phone is set up with the developer program to cancel subscriptions from the app we developed. However, after the OS update on the phone, the subscriptions no longer appear in the developer program, although the subscription does exist in the app itself. We are attaching the log.
🔖 8/9/2025, 10:59:44 AM
["expires_date_pst": 2025-09-08 21:58:36 America/Los_Angeles, "original_purchase_date_ms": 1753167687000, "original_purchase_date_pst": 2025-07-22 00:01:27 America/Los_Angeles, "purchase_date_ms": 1757307516000, "purchase_date_pst": 2025-09-07 21:58:36 America/Los_Angeles, "product_id": com.topwall.premium_trial.monthly.trial, "in_app_ownership_type": PURCHASED, "web_order_line_item_id": 2000000111040333, "purchase_date": 2025-09-08 04:58:36 Etc/GMT, "is_trial_period": false, "original_purchase_date": 2025-07-22 07:01:27 Etc/GMT, "expires_date_ms": 1757393916000, "expires_date": 2025-09-09 04:58:36 Etc/GMT, "transaction_id": 2000001002316107, "is_in_intro_offer_period": false, "subscription_group_identifier": 21733009, "original_transaction_id": 2000000966725103, "quantity": 1]
🔹🔹🔹🔹🔹🔹🔹🔹🔹🔹
🟢 8/9/2025, 10:59:44 AM
StoreKit isActive: true до 2025-09-09 07:58:36
Why do you think the subscription created in the app doesn’t show up in the sandbox?
Topic:
App & System Services
SubTopic:
StoreKit
What platform are you targeting? And what version?
iOS, testing in Sandbox on a physical device.
What version of Xcode are you using?
[Xcode __]
What version of the OS are you testing on?
iOS 18 on iPhone 15 pro.
What specific API are you using?
StoreKit 2 via Flutter’s in_app_purchase plugin (Dart), which uses in_app_purchase_storekit under the hood.
What are the exact steps you took?
In App Store Connect, I created several Consumable IAPs (status “Ready to Submit”).
Example product IDs:
USD3.99TenMinuteCoffeePlan (Consumable)
USD24.99OneHourDinnerPlan (Consumable)
USD14.99InviteAFriendAsGenie (Consumable)
Signed in as a Sandbox tester on device (Settings → App Store → Sandbox Account).
App queries products with InAppPurchase.instance.queryProductDetails(ids) — products load successfully.
Call buyConsumable(purchaseParam: PurchaseParam(productDetails: ...)).
Listen to purchaseStream and log PurchaseDetails.
If something failed, what are the symptoms?
The purchase sheet often does not appear.
The purchase stream reports PurchaseStatus.restored, immediately, for SKUs that are marked Consumable.
Example log lines (from Dart):
Products loaded: 6
Product: id=USD3.99TenMinuteCoffeePlan, price=3.99
Product: id=USD24.99OneHourDinnerPlan, price=24.99
Product: id=USD14.99InviteAFriendAsGenie, price=14.99
Purchase update: productID=USD3.99TenMinuteCoffeePlan,
status=PurchaseStatus.restored, pendingComplete=false, purchaseID=2000000991974131
Purchase update: productID=USD24.99OneHourDinnerPlan,
status=PurchaseStatus.restored, pendingComplete=false, purchaseID=2000000992079251
Purchase update: productID=USD14.99InviteAFriendAsGenie,
status=PurchaseStatus.restored, pendingComplete=false, purchaseID=2000000999910991
Purchase update: productID=USD29.99InviteAFriendAsGenie,
status=PurchaseStatus.restored, pendingComplete=false, purchaseID=2000001003571920
If nothing failed, what results did you see? And what were you expecting?
Actual: restored events (no sheet) for items configured as Consumable.
Expected: For Consumables, a purchase sheet followed by purchased status. Consumables shouldn’t “restore”.
What else have you tried?
Verified every SKU shows Type = Consumable and Ready to Submit in App Store Connect; “Cleared for Sale” enabled; pricing/localization filled.
Created new product IDs (to avoid any prior non-consumable history).
Verified I’m not calling restorePurchases.
In the listener, I only grant benefits on PurchaseStatus.purchased (not on restored).
Observed that queryProductDetails succeeds; some IDs that aren’t fully configured return “not found,” as expected.
Minimal code (core bits):
final _iap = InAppPurchase.instance;
Future<void> init() async {
final resp = await _iap.queryProductDetails({
'USD3.99TenMinuteCoffeePlan',
'USD24.99OneHourDinnerPlan',
'USD14.99InviteAFriendAsGenie',
'USD29.99InviteAFriendAsGenie',
});
_products = resp.productDetails;
_sub = _iap.purchaseStream.listen(_onUpdates);
}
Future<void> buy(ProductDetails p) async {
final param = PurchaseParam(productDetails: p);
await _iap.buyConsumable(purchaseParam: param); // iOS SK2 path
}
void _onUpdates(List<PurchaseDetails> list) async {
for (final pd in list) {
print('status=${pd.status}, id=${pd.productID}, pending=${pd.pendingCompletePurchase}, purchaseID=${pd.purchaseID}');
switch (pd.status) {
case PurchaseStatus.purchased:
// deliver & (if pendingCompletePurchase) completePurchase
break;
case PurchaseStatus.restored:
// for consumables, I do not deliver here
break;
default:
break;
}
}
}
Questions for the community/Apple:
Under what conditions would StoreKit 2 return restored for a SKU that’s set to Consumable?
Is there any server-side caching of old product type or ownership tied to a product ID that could cause this in Sandbox?
Is “Ready to Submit” sufficient for Sandbox testing of IAPs, or must the SKUs be attached to a submitted build before StoreKit treats them as consumable?
If a product ID was ever created/purchased as Non-Consumable historically, does creating a new ASC entry with the same string ID as Consumable still cause restored for that tester?
Besides creating brand-new product IDs and/or resetting the Sandbox tester’s purchase history, is there any other recommended way to clear this state?
Happy to provide a device sysdiagnose or a stripped test project if that helps. Thanks!
Hello all,
We developed an iOS app which we started advertising now. In our iOS app we already implemented the updatePostbackConversionValue(_:completionHandler:) to send in-app events in increasing numbers (first open -> 1, lead ->2, conversion -> 3).
From our understanding this should be enough for alle ad networks (Apple Ads, Google Ads, Meta Ads, Microsoft Ads and Reddit Ads) to receive those numbers - at least they receive the app installs from the SKAN already.
Is this correct or do we miss something here in the integration? We currently really struggle to assure that everything is working and we do not see any conversions coming in - even though two weeks of advertising have passed already.
I look forward for any feedback or discussion and I am also happy to share more details if needed.
Best regards,
Manuel
Topic:
App & System Services
SubTopic:
StoreKit
I want to test the "Remove from Sale" scenario in Sandbox. I set my subscription to "Remove from Sale" for all territories in App Store Connect, but I can still make new purchases and auto-renewals continue in the Sandbox environment.
Is this a known limitation? Or is there a specific way to make this work for testing?
If it can't be tested, I'd like to know the expected production behavior. What changes occur in the App Receipt and what App Store Server Notification is sent?
Cannot retrieve products for iap or subscription on simulator iPhone 16 and real device iPhone XR also.
lutter: IAPError(code: storekit2_products_error, source: app_store, message: The operation couldn’t be completed. (NSURLErrorDomain error -1009.), details: The operation couldn’t be completed. (NSURLErrorDomain error -1009.))
flutter: Error fetching IAP products: IAPError(code: storekit2_products_error, source: app_store, message: The operation couldn’t be completed. (NSURLErrorDomain error -1009.), details: The operation couldn’t be completed. (NSURLErrorDomain error -1009.))
SKProductsRequest always returns as USD not local currency for debug environment and even some time it fails. This is only happening for debug or TestFlight build.
I have consumable IAPs in my app. Currently there is no way for me to test refunds for them as Xcode testing doesn't allow refunds option for my Purchases. According to this official documentation on Transaction.all , i should be getting my refunded consumables in Transaction's all property.
But there is no way for me to know what kind of data is in the refunded transaction object. Will there be a 'revocation date' like in the case of non-consumables?
What is the expected behavior for App Receipts and ASSN v2 notifications when a subscription is set to "Remove from Sale"?
I tried to test this in Sandbox, but the "Remove from Sale" setting in App Store Connect doesn't seem to affect the Sandbox environment.
For existing subscribers, what happens in the receipt? Does auto_renew_status change to 0 and is expiration_intent populated immediately?
Also, which notificationType is sent via ASSN v2?
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
Subscriptions
In-App Purchase
App Store Server Notifications
App Store Receipts
Question:
In the sandbox environment, I attempted to perform an In-App Purchase within an IME (Input Method Extension) using a sandbox test account. The purchase flow completed successfully, and I received the success callback.
However, I encountered an issue: no receipt file is generated. I tried checking with both the main app’s bundle and the IME’s bundle, but the receipt file was not found in either case.
When I attempted to refresh the receipt using SKReceiptRefreshRequest, it failed with an exception (error code: 0).
I would appreciate any guidance on how to resolve this issue.
I tested a subscription with my developer account, it never charges but at the same time I can't cancel it anymore. It does not appear in the list of my official purchsed subscriptions. I tried to login to the sandbox with my developer account, but then when I click on "Manage" I just keep getting the error "Can't connect - retry".
I have already tried to logout from all the services, App store, etc. and re-login, nothing worked.
Is there anything I can do?
Thanks in advance to anyone who can give any tips.
I would like to know if it is allowed to offer the user to either unlock the app immediately or partake in a 3-day trial period before making a purchase.
I created 2 IAP non-consumable products; 1 for the immediate [which is at a discount] and for the after trial period ends [this is at a higher cost].
Is this something that Apple allows or is frowned upon?
When trying to login with sandbox account in my simulator, nothing happens, it just become inactive for few seconds and then it become active again prompting that I can login, again and again.
I have an auto-renewable subscription. I have two methods helping me keep track of when they are expired
@MainActor public func isPurchased(product: Product) async -> Bool {
guard let state = await product.currentEntitlement else {
return false
}
switch state {
case .unverified(_, _):
return false
case .verified(let transaction):
await transaction.finish()
return isTransactionRelevant(transaction)
}
}
private func isTransactionRelevant(_ transaction: Transaction) -> Bool {
if let revocationDate = transaction.revocationDate {
logger.error("Transaction verification failed: Transaction was revoked on \(revocationDate)")
return false
}
if let expirationDate = transaction.expirationDate,
expirationDate < Date()
{
logger.error("Transaction verification failed: Transaction expired on \(expirationDate)")
return false
}
if transaction.isUpgraded {
logger.error("Transaction verification failed: Transaction was upgraded")
return false
}
logger.info("Transaction verification succeeded")
return true
}
I also have this that I can call to get the latest state of purchases
@MainActor public func updateStoreKitSubscriptionStatus() async {
var currentProductsPurchased: [Product] = []
for await result in Transaction.currentEntitlements {
if case .verified(let transaction) = result {
if isTransactionRelevant(transaction) {
if let product = products.first(
where: { $0.id == transaction.productID
})
{
currentProductsPurchased.append(product)
}
}
await transaction.finish()
}
}
self.purchasedProducts = currentProductsPurchased
}
Right now when a subscription expires the user needs to manually do some action that triggers updateStoreKitSubscriptionStatus() as it appears that expirations do not come through in Transaction.updates.
I am surprised there does not seem to be a better way. Does StoreKit not notify you somewhere that an auto-renewable subscription has expired? Can you observe it in an ObservableObject? Or do I need to just frequently poll Transaction.currentEntitlements even if I dont expect frequent updates?
Topic:
App & System Services
SubTopic:
StoreKit
在沙盒环境下或者TestFlight 测试消费型项目会提示此项目将免费恢复
Is there an App Store Server API available that allows cancellation of specific subscriptions by specifying transaction_id or similar identifiers?
Background of these questions:
We occasionally suspend user accounts due to violations of our service terms and conditions. In such cases, we would like to forcibly cancel their subscriptions if possible. However, we could not find relevant information in the documentation, which is why we are reaching out with these questions.
Please let us know.
We have a user that has an active subscription according to the appstore in our product but it is registering as expired. Hitting the subscribe button in the SwiftUI SK2 dialog does nothing, meaning, nothing happens.
Any ideas?
Topic:
App & System Services
SubTopic:
StoreKit