StoreKit

RSS for tag

Support in-app purchases and interactions with the App Store using StoreKit.

StoreKit Documentation

Post

Replies

Boosts

Views

Activity

促销优惠 报错ineligibleForOffer
你好: 以下是我的问题: 问题类型:苹果内功IAP相关问题 问题详情:我想问一下苹果的按月订阅商品设置了“促销优惠”(即在调用支付API时设置了paymentDiscount字段),具体优惠内容为首月免费,这种“促销优惠”优惠形式对首次订阅的账号无效吗?因为首次订阅的账号尝试订阅时会返回ineligibleForOffer错误,导致无法正常订阅,希望得到回复。谢谢
1
0
197
Sep ’24
Clear Purchase History for a Sandbox Apple ID doesn't work
Hello, I'm trying to clear the purchase history made with a sandbox Apple ID on my test device but it does not work. The past purchases are still returned by StoreKit. I've waited many hours but it seems to persist. When I use for await result in Transaction.currentEntitlements { in my app, my non-consumable product is still here. Is it expected? How long should it take to reset the history? Is is supposed to work also for non-consumable products? Thanks Axel
2
0
362
Sep ’24
How do you request a review in a volumetric app?
I have a volumetric app. I am trying to present a review prompt using SKStoreReviewController's requestReview(in:) I'm using the code below: if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { SKStoreReviewController.requestReview(in: scene) } When this code executes, though, I get a crash with the error: Presentations are not permitted within volumetric window scenes. What is the proper way to do this for a volumetric app?
1
2
386
Feb ’24
Removing In-App Purchases, consequences and questions.
Hi, I have a question regarding a set of existing in app purchases as we are planning on making a set of changes to our application. For context we are a B2B application that sells a web based tool directly to businesses. Really due to historical reasons we made recurring subscriptions available in the iOS app store and have a number of tiers users can select. Our service is getting a little more complicated, we offer a lot of stuff outside of the app store and looking at the rules: 3.1.3(f) Free Stand-alone Apps: Free apps acting as a stand-alone companion to a paid web based tool (e.g. VoIP, Cloud Storage, Email Services, Web Hosting) do not need to use in-app purchase, provided there is no purchasing inside the app, or calls to action for purchase outside of the app. It would make a lot of sense for our App to become a companion to our main service. As far as I understand this means what we need to remove the App Store subscriptions, there is no call to action in app to buy outside of the app store. However, what happens to the existing subscribers to the service? By removing the in app purchases from the app will these existing subscribers still continue to be subscribed? We don't have that many users that buy in app but we don't want to mess up their experience. For example, we don't want these subscriptions to just cancel and their access be removed. Also is this a fair understanding of the rules as we don't want to fall foul of them. I think this is a similar question to this thread, but obviously want to check before making this change. Thank you!
2
0
274
Aug ’24
Reponse in blank by "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/subscriptions" in spite of passing valid transactionId
Hello, A user subscribed by in-app purchase subscription in the app "Target Leaderboard". We have got the transaction Id and base64 encoded receipt data in response. We can generate the JWT by the In-app purchase key file and key Id. But when we try to fetch all subscriptions by "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/subscriptions" by passing the transaction Id, blank response is returned. Why it is happening? Also, when we are try to fetch original transaction Id by "https://sandbox.itunes.apple.com/verifyReceipt" by passing the base64 encoded receipt data and SharedSecret, code 21003 is returned. Why it is happening? Please help.
4
0
428
Sep ’24
StoreKit causes transactions that has already finished to occur again.
■Incident After executing restoreCompletedTransactions and finish a transaction of the StateRestored that occurred, the finished transaction occurred again as StatePurchased. StatePurchasedagain. When this occurred, no functions other thanrestoreCompletedTransactionswere called, the Transaction identifier was the same and only the state changed fromStateRestoredtoStatePurchased`. This is not a subscription renewal or other timing. ■Information I want to get. We are aware that StatePurchased Transactions that have been purchased and finishTransaction in the past will not occur again with updatedTransactions. However, by performing the following steps, a finishTransaction Trasnsaction that has been finishTransaction will occur again. What is the cause of this and how can it be addressed? ■step prepare an App Store account (Sandbox) with a lot of purchase information. In the case of the actual account where the event occurred, there were approximately 70 purchases. The event occurs even if the subscription is still subscribed or the subscription period has ended. The event has been confirmed in both Sandbox and production environments. call restoreCompletedTransactions against SKPaymentQueue. updatedTransactions is called and an array of Transactions is passed over. In this case, the transactionState of all Transactions is StateRestored. when the Transaction passed in 3 is finished for SKPaymentQueue, updatedTransactions` is called again. Except that in this case, all Transactions have a transactionState of StatePurchased, All properties are identical to those passed in 3, including the transactionIdentifer. However, not all of the array of Transactions passed in 3 is passed, but some of it. (In the actual event, 75 Transactions were passed in 3 and 35 Transactions were passed in 4.)
1
0
256
Sep ’24
Query Regarding Applying Discounts to Non-Renewing Subscriptions
Dear Apple Support, I hope this message finds you well. We are currently working on a feature involving the purchase of Non-Renewing Subscriptions within our app. Our business requirement is to offer a single product subscription plan priced at $100, and we would like to introduce a coupon feature that offers a 15% discount, reducing the cost for the end user to $85. We want to ensure that the end user is charged the discounted price at checkout. Could you please advise if there is a recommended approach to implement this discount directly within the subscription purchase flow? Your guidance on this matter would be greatly appreciated.
0
0
181
Sep ’24
iOS In-App Purchase works in sandbox and flight test, but was rejected by apple
We recently submitted an update to an existing app that already has an in app purchase for an annual subscription which works perfectly fine. However, the update has been rejected 5 times by Apple stating the in app purchase does not work. We have not made any changes to the update regarding the in app purchase AND the in app purchase works perfectly fine on device testing AND in flight test. Can some one please help? Anyone know what is going on?
3
0
439
Aug ’24
Recent update encountered in-app purchase can not normally pull the offer information
I recently submitted an App update, but it was rejected several times, because the free 3-day trial of the subscription product was not displayed, but the app interface advertised the free trial. At present, this subscription product has been approved by AppStore. Previous versions have 3 days of free promotional information appeared. This version was rejected after the update, after local testing found that even if we use the new sandbox test account test, always can not get free 3-day discount information. I then tested other apps that had already been developed and were unable to get the 3-day free offer. However, my application update this time did not change the code logic related to in-app purchase, but the experience optimization of other functions. I guess it is because of the new product conference of Apple on September 10th, and whether Apple's policies and systems have been updated? Since this pop-up interface is StoreKit pop-up, the developer can not do anything about it. I wonder if anyone else has had the same problem as me? I hope relevant developers or technicians can provide technical help, thank you very much!
0
0
232
Sep ’24
Un-understandable error thrown when calling Product.products(for:))
Hi, Whenever trying to call Product.products(for: list) where list contains ids of my subscriptions, I get the following error. I can't seem to catch this error regardless of how i try to implement do/catch, and it only happens on real IDS, if i use an ID that doesn't exist, then it just returns an empty list and doens't crash. I haven't deployed my app yet, and it's my first app, so I'm not sure if it may be an issue with the subscriptions not being approved yet. I do have all of my agreements signed / bank accounts setup, so i'm not sure. libswiftCore.dylib`swift_willThrow: -> 0x1a10b9f58 <+0>: pacibsp 0x1a10b9f5c <+4>: str x19, [sp, #-0x20]! .... @MainActor class PurchaseManager: ObservableObject { private let productIds = ["00"] @Published private(set) var products: [Product] = [] private var productsLoaded = false func loadProducts() async throws { guard !self.productsLoaded else { return } self.products = try await Product.products(for: ["com.one_dollar"]) self.productsLoaded = true print("Products") print(self.products) } .... } where i'm calling it: struct AmountSelectionView: View { @EnvironmentObject var purchaseManager: PurchaseManager // Add this line var body: some View { HStack(spacing: 16) { ... } .padding() .padding(.top, -30) .task { Task { print("Loading Products") do { try await purchaseManager.loadProducts() } catch { print("error") print(error) } } } } }
3
0
355
Aug ’24
Transaction.updates did not receive the recently occurred transaction.
When I purchase a 7-day membership product and kill the app during the purchase, then complete the purchase outside the app, there is a chance that upon reopening the app, I do not receive the transaction from Transaction.updates. but, then I iterate through the Transaction.unfinished queue, I found the transaction. Steps to reproduce: 1.Initiate Purchase: Start purchasing a 7-day membership product within the app. 2.Kill the App: During the purchase process, kill (force close) the app. 3.Complete Purchase Outside the App: Complete the purchase outside of the app (e.g., through an App Store prompt). 4.Reopen the App: Reopen the app after completing the purchase.
0
0
159
Sep ’24
currentEntitlementTask latency and inconsistency
Hi, I have the following implementation for a non-consumable IAP. In the relevant SwiftUI views: currentEntitlementTask(for: "com.example.FullApp") { state in self.appUnlocked = await AppStoreWrapper.shared.appUnlocked(verification: state.transaction) } and AppStoreWrapper: actor AppStoreWrapper { static let shared = AppStoreWrapper() private var updatesTask: Task<Void, Never>? func observeTransactionUpdates() { self.updatesTask = Task { [weak self] in for await update in Transaction.updates { guard let self else { break } await self.process(transaction: update) } } } func process(transaction verificationResult: VerificationResult<Transaction>) async { guard case .verified(let transaction) = verificationResult else { return } if case .nonConsumable = transaction.productType { await transaction.finish() } } func appUnlocked(verification: VerificationResult<Transaction>?) -> Bool{ guard let verification = verification, let transaction = try? verification.payloadValue else { return false } return transaction.revocationDate == nil } } The problem now is that on app launch, there is some latency until some views appear unlocked. It takes around 5 seconds to unlock everything and sometimes some instances of the same view remain to appear locked even after a while. Is this an expected behaviour of currentEntitlementTask? should I store the purchase state somewhere else like UserDefaults to mitigate this latency? I thought that UserDefaults are insecure to store this information, what's the best practice here?
0
0
206
Sep ’24
Receipt verification issue in production environment
Hello team, It'd be very grateful if you give us some advice for our issue. It's about receipt verification in production environment. Details are as follows. User tried to purchase consumable IAP in production environment. Price is charged for IAP. After that, tried to verify receipt using the receipt of the transaction, but it failed with an error message. "21004 The shared secret you provided does not match the shared secret on file for your account." This error occurs only sometimes, not always. Most of purchase succeeded without this issue. For your reference, we've sold subscription IAP but now stopped to sell subscription IAP since last year. And we've been transferred this app from other iOS team last year. Our iOS developer account have configured both primary shared secret and app-specific shared secret for this app. I've found the similar issue with ours. https://forums.developer.apple.com/forums/thread/746202 Thank you. Best regards
1
0
307
Sep ’24
Annual auto renewal subscription wrong year
Hi, I'm developing my first app with in-app purchase and I'm having this problem: a tester in testFlight is buy the auto renewal annual subscription the purchase process ends correctly the expiration date of the receipt has the actual year and not the next one! What I'm wrong? Whay the expiration date isn't 2025 instead of 2024 as aspected? This is the code that verify the receipt: func verifySubscription() -> Bool { guard let receiptData = fetchReceipt() else { return false } do { let receipt = try InAppReceipt.receipt(from: receiptData) let purchases = receipt.purchases for purchase in purchases { if purchase.productIdentifier == productID { if let expirationDate = purchase.subscriptionExpirationDate { UserDefaults.standard.set(expirationDate.formattedStringWithTimeZone(withFormat: "yyyy-MM-dd HH:mm:ss"), forKey: K.userDefault.subscriptionExpirationDate) return expirationDate > Date() } } } } catch { } return false } Thanks a lot in advance.
1
0
190
Sep ’24
How to determine active subscription by inspecting receipts
As a part of moving my app to a subscription model, I'm now struggling with allowing the user to manage their active subscription. I have the infrastructure in place to purchase, restore and query all the receipt data from Apple's servers and am currently testing with sandbox accounts. What I'm struggling with is knowing what subscription APPLE thinks the user is subscribed to. This is only a problem when the user wants to change their subscription but either upgrading or downgrading. What can happen is that a user might decide to change their subscription (to take affect after their current subscription expires, etc.) I want to be able to show the user what they are subscribed to, but for the life of me, I don't know how to do it. It's not always the "most recently purchased and still active" subscription as determined by inspecting the receipts. Obviously I could remove the ability to change the subscription plan from within the app... or just allow only ONE product per group. But that feels wrong. Does anyone know how to simply ask Apple (programatically) "What product is the user currently subscribed to?" Apple's rules say only one product per group, but I can't find this info documented anywhere.
1
0
188
Aug ’24
Subscription Unavailable - Strange Behavior with StoreKit
I added my first subscription to my app using StoreKit's SubscriptionStoreView. Everything worked as expected in the debug environment and also in TestFlight. So I submitted my app and subscriptions to App Store Connect, got everything Approved and released. After updating my app through App Store and checking the Subscription View, it just says "Subscription Unavailable. The subscription is unavailable in the current storefront." I waited around 3 days and still getting the same message. Now the very strange behavior starts. I went to App Store Connect, I made and edit to the subscription description, saved, removed the edit, saved, and submitted to review. 15 minutes later the subscriptions appear in my app and everything works as expected. After getting the edit approved, the Subscription View in my app again only showed the message "Subscription Unavailable. The subscription is unavailable in the current storefront." No user is able to see the subscriptions anymore, even though it worked as expected before the edit was approved. So I did the same as before. Again, make an edit to the subscription description, save, remove the edit, save, submit to review. 15 minutes later the subscriptions are again available in my app and it works as expected. This is definitely not the expected behavior and submitting the subscription edits every day is wasting the App Review Team's time as well as mine. I contacted Apple Developer Support but I didn't get any reply back (at least yet). I am not the only one experiencing this. I found a friend online who has the exact same issue, and is able to temporarily solve it by making an edit to the subscription description as well. So far it has been a huge headache, and we are losing customers this way. Please if anyone has experience with this problem, or has any suggestions, they will be greatly appreciated. Thank you so much, Tomas
26
13
2.9k
Jul ’24
Use of the App Store Server API in a production environment.
When submitting an app, reviewers are aware that they are using the In App Purchase in Sandbox environment. Therefore, we recognize that when processing an app to run the App Store Server API from the app, the production App Store Server API must be run, and if it is a failure, the Snadbox API must be run. As follows. https://developer.apple.com/documentation/appstoreserverapi#3820693 This would result in two http communications, so is there any more efficient way to do this?
1
0
317
Aug ’24