StoreKit

RSS for tag

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

Posts under StoreKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

App Only Crashes on Launch in iOS 17.4 for Production Version
Hello, I'm encountering an issue where my released app fails to launch only on iOS 17.4. The version of the app released through TestFlight works fine without any issues. Specifically, when the app installed from the App Store is launched on iOS 17.4, it immediately crashes. However, I've noticed the following: If I turn off the network connection, such as putting the device in Airplane Mode, the app launches successfully. Once the app is launched, I can re-enable the network connection, and the app continues to run without crashing. My app uses StoreKit2 for handling transactions and connections with the App Store. It initiates a connection to the App Store via StoreKit2 at launch. The primary difference between the TestFlight version and the production version is the App Store endpoint they connect to. This leads me to suspect that there might be an issue with the connection to the App Store. (Another possibility is that the app communicates with Firebase or Google Admob, so there could be an issue with these SDKs as well.) This issue only occurs in the production version, making it difficult to investigate. Are there any suggestions on what I can do to further diagnose this issue? You can download my app from here: https://apps.apple.com/us/app/repeatable-player-cut-loop/id616310281 I can provide the TestFlight URL if needed. Any help or guidance would be greatly appreciated.
1
1
2.4k
Mar ’24
How to test subscriptions through Storekit 2 in Sandbox?
Hey all, Tl;dr: In debug-build using a .storekit file, all is good. When uploading a release build to testflight, purchasing follow the expected flow, but it does not seem the subscription status is reflected. Full description I've implemented auto-renewable subscriptions in my app. In debug, I've setup a scheme to use products.storekit. When I run this scheme on my device, I can subscrbe, cancel etc, and it all works as expected. When I upload my release scheme to testflight, purchasing can be done, but changes do not seem to be reflected inside the app (i.e.e no features get unlocked). Same thing when I run this scheme on my device. This scheme has None set for Storekit configuration. When I set 'Storekit configuration' to the Products.storekit, file I can't make a purches at all: SubscriptionStoreView shows Subscription unavailable. The subscription is unavailable in the current storefront'. I've watched a number of WWDC sessions on the topic, read most (all?) of the documentation, and I just can't seem to find out what it is that needs to be done. Unfortunately, debugging has been rather cumbersome and sometimes impossible lately, especially when trying to debug a release build. Anyone can tell me what it is I am overlooking, or what piece of information or link I missed? Here is the relevant code (which works OK in debug) private func listenForTransactions() -> Task<Void, Error> { return Task.detached { for await anUpdate in Transaction.updates { do { let transaction = try self.checkVerified(anUpdate) await self.checkSubscriptionStatus() await transaction.finish() } } } } And here's checkSubscriptionStatus(): @MainActor private func checkSubscriptionStatus() async { var hasActiveSubscription = false do { for aStatus in try await Product.SubscriptionInfo.status(for: "718A7488") { let state = aStatus.state hasActiveSubscription = (state == .inGracePeriod) || (state == .subscribed) } } catch { print(error) } self.hasActiveSubscription = hasActiveSubscription }
0
1
607
Mar ’24
How to detect when auto-renewing subscription expires?
Hi all, I've implemented in-app purchases to have auto-renewing subscriptions. However, when I use Xcode's Transaction Manager to expire a subscription, there seems to be no callback Transaction.updates or Transaction.currentEntitlements I can see an expiry through Transaction.all but I can't imagine the intention is to poll that while the app is running. What am I missing here?
1
0
385
Mar ’24
Testing in-app purchases
I need to test my app's in-app purchases and I am having a very difficult time with it. I created a "Sandbox" account in App Store connect. Doing so was very frustrating. It told me multiple times that my password was "too simple", without ever explaining what the password rules are. Then it emailed me something so I could "validate" the account. Luckily I used an actual email address that I can receive mail on. I was expecting I could use any fake address since this is a Sandbox account. After that I started an iOS simulator and tried to log in. It immediately asked me to turn on two-factor authentication. I declined, and then it just said "User name or password is incorrect". I tried a couple more times, then I went back and actually turned on the two factor auth. But that didn't solve the problem. I still cannot log in. Can someone explain what I'm doing wrong here?
0
0
406
Mar ’24
Encode purchase payload as JSON and pass to request.httpBody
Hi All, I have this code and I would like to send the payload of the completed purchase to my server. How to do that? Regards Thomas S ` SubscriptionStoreView(...) .onInAppPurchaseCompletion { product, result in if case .success(.success(let transaction)) = result { print("Purchased successfully: \(transaction.signedDate)") // this looks good in Xcode // Pass payload of transaction to my server let url = URL(string: "... my server ...")! var request = URLRequest(url: url) request.httpMethod = "POST" request.httpBody = ???? // how do I pass the payload of the transaction to the httpBody request.setValue("application/json", forHTTPHeaderField: "Content-Type") let task = URLSession.shared.dataTask(with: request) { data, response, error in let statusCode = (response as! HTTPURLResponse).statusCode if statusCode == 200 { print("SUCCESS") } else { print("FAILURE") } } task.resume() } else { print("Something else happened") } } `
2
0
310
Mar ’24
SubscriptionStoreView how to handle the Cancellation Button
Hi All, I use the SubscriptionStoreView and it displays a cancellation button in the upper right corner. How do I set a value of a local variable and dismiss the SubscriptionStoreView when the user clicks the cancellation button? Right now it seems as if the cancellation button is disabled and nothing happens when I press the cancellation button. Any help is appreciated. Regards Thomas S
1
0
288
Mar ’24
Issues with StoreKit2 and TestFlight
Transaction.updates When testing on TestFlight, Transaction.updates emits payments that occur on the same device (usually within 1min after payment is finished), contradicting the docs: The asynchronous sequence that emits a transaction when the system creates or updates transactions that occur outside of the app or on other devices. Transaction.unfinished When testing on TestFlight, Transaction.unfinished contains finished payments from a different device (same App Store account). Docs: A sequence that emits unfinished transactions for the user. Both issues do not happen when testing with Xcode. Xcode 15.2, iOS 17.3, 17.4
0
0
345
Feb ’24
Install-validation postback is not received
Hi, We have Apple Search Ads for promoting our app. We are able fetch attribution records of those ads using AAAttribution inside app and send to our server and it is working fine. Now, we would like to receive Install-validation postbacks by setting NSAdvertisingAttributionReportEndpoint into our domain name and configured the server to receive HTTPS POST messages as per the instruction provided in the below link. Steps done Set NSAdvertisingAttributionReportEndpoint into our domain name Our server configured the server to receive HTTPS POST messages Made sure that updatePostbackConversionValue is called while app is launched. https://developer.apple.com/documentation/bundleresources/information_property_list/nsadvertisingattributionreportendpoint In our live app, we are keep getting attribution records using AAAttribution inside our app and sending them to our server. It is working fine now. But we did not receive any Install-validation postback yet into the URL provided in NSAdvertisingAttributionReportEndpoint. To troubleshoot this, i clicked Apple Search Ad of our app in App Store, i installed our app and opened it and in the console i can see the below error message. Error updating install attribution pingback for app: <OUR_APP_ID>, error: Error Domain=ASDErrorDomain Code=1208 "SKAdNetwork: No pingbacks found while attempting to register/ update." UserInfo={NSLocalizedDescription=SKAdNetwork: No pingbacks found while attempting to register/update.}, result: 0 I have attached console log for your reference. Is there any step i am missing to receive Install-validation postback in our server? Is there any way to validate domain name provided in nsadvertisingattributionreportendpoint so that we can check if any server configuration issue? Please advise on getting Install-validation postback in our server, Thank you.
0
0
485
Feb ’24
SubscriptionStoreView showing 'The subscription is unavailable in the current storefront.' in production (StoreKit2)
I Implement a 'SubscriptionStoreView' using 'groupID' into a project (iOS is targeting 17.2 and macOS is targeting 14.1).Build/run the application locally (both production and development environments will work fine), however once the application is live on the AppStore in AppStoreConnect, SubscriptionStoreView no longer shows products and only shows 'Subscription Unavailable' and 'The subscription is unavailable in the current storefront.' - this message is shown live in production for both iOS and macOS targets. There is no log messages shown in the Console that indicate anything going wrong with StoreKit 2, but I haven't made any changes to my code and noticed this first start appearing about 5 days ago. I expect the subscription store to be visible to all users and for my products to display. My application is live on both the iOS and macOS AppStores, it passed App Review and I have users who have previously been able to subscribe and use my application, I have not pushed any new changes, so something has changed in StoreKit2 which is causing unexpected behaviour and for this error message to display. As 'SubscriptionStoreView' is a view provided by Apple, I'm really not sure on the pathway forward other than going back to StoreKit1 which I really don't want to do. Is there any further error information that can be provided on what might be causing this and how I can fix it? (I have created a feedback ticket FB13658521)
3
2
782
Apr ’24
StoreKit SDK
Good day! I have a problem with the presentCodeRedemptionSheet method. The problem is that when the sheet for entering the promotional code appears, I fill in the field with the promotional code and when I click the Redeem Code button, nothing happens, the button becomes inactive for some time, but nothing else happens, the promotional code is not applied. However, this behavior occurs every now and then, that is, to put it simply, this flow works only 1 time out of 5 times, and then not always. Please tell me, has anyone encountered this problem before?
0
0
300
Feb ’24
The StoreKit offerCodeRedemption(isPresented:) view modifier is not working for subscriptions.
The StoreKit offerCodeRedemption(isPresented:) view modifier is working fine for redeeming consumable offers from App Store Connect, but it fails to redeem subscription offers: When this same offer code is used in the App Store redemption flow, everything works as expected. So there's nothing wrong with the offer codes. Is there a trick to using offerCodeRedemption(isPresented:) when working with subscriptions rather than consumables? Any help is appreciated!
0
0
308
Feb ’24
Reporting StoreKitErrors with ProductView (StoreKit2)
Testing in-app purchase with the App Store Connect / Xcode configuration file allows testing of approximately 43 non-consumable product errors. Testing my non-consumable in-app purchase with the new ProductView on my app for these various faults doses’t appear to be very promising. Loading errors: all result in a blank screen and spinning wheel without producing an alert. Purchase errors: Some of these work producing readable comments. Purchase (not entitled) and Purchase (system error) just produce alert boxes with an OK button. Purchase (network) produces the alert “The operation could not be completed. (NSURLErrorDomain error - 1009.)” Verification errors, App Store Sync, and App Transaction errors: These purchases are successful and produce no alerts. Am I missing a method that handles these errors? With ProductView do I need to use a do / catch block in my viewModel? Can I release this app for review working like this? struct StoreView: View { @StateObject private var store = StoreModel() var body: some View { GeometryReader { g in VStack { Spacer() Text("\(mainTitle)") .font(.title) .padding(.bottom, 25) ProductView(id: "xxxx") { _ in Image(systemName: "xxxx") .resizable() .scaledToFit() } placeholderIcon: { ProgressView() } .productViewStyle(.large) .overlay( RoundedRectangle(cornerRadius: 20) .stroke(Color( "darkGreen"), lineWidth: 5) .frame(width: g.size.width * 0.90, height: g.size.height * 0.35 ) ) .frame(maxWidth: .infinity, alignment: .center) Spacer() } } } } @MainActor final class StoreModel: ObservableObject { @Published private(set) var products: [Product] = [] @Published private(set) var activeTransactions: Set<StoreKit.Transaction> = [] @Published var gotRefund = false // use to reset purchase private var updates: Task<Void, Never>? private var productIDs = ["xxxxx"] // app wide purchase status @AppStorage(StorageKeys.purStatus.rawValue) var storeStatus: Bool = false init() { updates = Task { for await update in StoreKit.Transaction.updates { if let transaction = try? update.payloadValue { await fetchActiveTransactions() // check transaction.revocationDate for refund if transaction.revocationDate != nil { self.storeStatus = false // requesting refund self.gotRefund = true } else { self.storeStatus = true // making purchase } await transaction.finish() } } } } // end init deinit { updates?.cancel() } // update the current entitlements func fetchActiveTransactions() async { var activeTransactions: Set<StoreKit.Transaction> = [] for await entitlement in StoreKit.Transaction.currentEntitlements { if let transaction = try? entitlement.payloadValue { activeTransactions.insert(transaction) } } self.activeTransactions = activeTransactions } }
0
0
316
Feb ’24
Can't fetch products from App Store connect
I had everything working with Revenue Cat. Then my app got rejected for not loading subscriptions, which was odd because a previous built was rejected for wording on that same paywall. I checked, and realised I suddenly can't fetch products in testFlight either. I can only see products in Xcode using the store kit configuration file. I've found many issues like this online and everybody point to the same solutions (that seem to work for most), but here's what I tried so far: Checked that all my agreements in App Store Connect are active Checked that ids match between Xcode / revenue cat / App Store connect Store kit config file is syncing with App Store Connect correctly I removed revenue cat and used the store kit api directly to fetch products. The array of products is empty in all environments that don't have access to store kit config file. Checked status of all subscriptions (all waiting for review -- as they were when the paywall worked) Nothing seems to work... Any suggestions? Many thanks
1
0
406
Feb ’24
StoreKit's manageSubscriptionsSheet view modifier not loading
Our app was just rejected by Apple because they say the subscription management sheet never loads. It just spins indefinitely. We're using StoreKit's manageSubscriptionsSheet view modifier to present the sheet, and it's always worked for us when testing in SandBox. Has anyone else had this problem? Given that it's Apple's own code that got us rejected, what's our path forward?
3
0
437
Feb ’24
When and why SKPaymentQueue.default().storefront is `nil` in release builds, all iOS versions
In our app we fetch the storefront country code: SKPaymentQueue.default().storefront?.countryCode We were not sure if all users will have this property available and we track to Bugsnag when this is nil. It turned out that over 6k users don't have this property available (shortly after the release) the number is larger than we expected. Looks like it affects all iOS versions (87 iOS versions from iOS 13.x to iOS 17.x) and models (95 in our case). It is not clear when and why this would be nil. It is not related to internet availability or to the timing of calls (e.g. it happens shortly after the app starts or hours after the app was started). So, when and why would the SKPaymentQueue.default().storefront be nil`? Thanks!
0
0
349
Feb ’24
Provisioning Profile doesn't incloud External Purchase entitlement.
I followed the official Apple documentation to integrate external puchase, but after adding the com.apple.developer.storekit.external-purchase key to the entitlements plist file, I got the following error: "Provisioning profile "{company name}" doesn't include the com.apple.developer.storekit.external-purchase entitlement." error and fails to build. https://developer.apple.com/support/storekit-external-entitlement-kr/
1
0
332
Feb ’24
Sandbox: Testing in app purchase issue (no products retrieved from app store connect)
All of a sudden, I am no longer able to test in app purchases on testflight builds. try await Product.products(for: [productID]) returns an empty array. Production (app in app store) functions just fine. But when I test the release build of the production version or any other versions, the fetch returns an empty array. This seems to be a sandbox issue. The ID is correct, Tax and banking forms are valid... This isnt the first release with in-app purchase or subscriptions so I am not sure why I am having this sandbox issue.
3
1
422
Feb ’24
how can manage In app purchase for selected courses with single payment
We have 5 subcourses like below subcourse1 - 10RS subcourse2 - 20RS Sucourse3- 5RS subcourse4- 11 RS supcouse5 - 12RS If the user selected sourcouse1 and subcourse3 and chose external gateway then we can easily take 15rs payment from external gateway (for any combination of selection of subcourses). Now if user selected subcourse1 , subcourse2, subocourse4 and chosen in app purchase option now we have to take payment of 41rs together. this is not possible unless we create any sku of combination of subcourse1 , subcourse2 and subcourse4. (practically we can create all sku combination for 5 sub courses) for subcourse1, subcourse2 and subcourse3 there are possible combination are subcourse1 subcourse2 3.subcourse3 4. subcourse1 and subcurse2 5. subcourse1 and subcourse3 6. subcourse2 and subcourse3 So we need to create 5 sku in app purchase for taking payment for all user selection combination Now if we have a total of 10 subcourses then there will be multiple combinations (total 3,628,800) . it is not practical to create sku for all 3,628,800 combination please suggest any way to handle my use case or should We prefer external gateway?
0
0
188
Feb ’24
In-app Purchases not working correctly.
I have uploaded one of my app to give some paid service. But when the user tries to make an in-app purchase, it opens one screen like the title is "Apple ID, Almost there Payment request will be created for xyzdemo@ybl" After I press the continue button this window(Screen) closes automatically. But UPI requests are sent on the particular app. So why is this happening on my app? Why does this window (Screen) dismiss automatically? I have also attached the screen. This screen automatically dismissed.
2
0
505
Feb ’24
The in-app payment window is not displayed on the commercial apps deployed in the App Store.
The in-app payment window is not displayed on the commercial apps deployed in the App Store. (IAP is subscription type) It is a WKWebView app, and in the development environment (build, testflight), the in-app payment window is displayed when the product button is pressed (sand box environment) This app has been commercially distributed. And when you press the product button in actual commercial, the in-app payment window is not displayed. Before payment, access the apple receipt server corresponding to the commercial server, determine whether it is [already subscribed] and display the payment window. [Example] https://buy.itunes.apple.com/verifyReceipt I got you to call. The source code related to No. 3 above is complicated, but there are many do-catch and if-else, and if it does not work normally, the source code is written to display an error message using an alert, but the alert is not displayed in actual commercial use.
0
0
212
Feb ’24