StoreKit

RSS for tag

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

StoreKit Documentation

Post

Replies

Boosts

Views

Activity

Can I use AppTransaction to verify purchase of a paid macOS app?
I've tried to use AppTransaction.shared / AppTransaction.refresh() to verify that my app has been purchased from the Mac App Store. It works when testing a release build on my Mac, using a Sandbox Apple ID. But when I submit the app for review, the reviewer says it doesn't work. The error message returned by AppTransaction is "Unable to Complete Request", which is pretty vague. I get the same error when I try to use a real Apple ID for testing on my machine, so I have been wondering if maybe the problem is that App Review is testing a build that doesn't accept Sandbox Apple IDs? My app doesn't have a provisioning profile, could it be that this is the problem? As a Mac app developer, I'm not sure what provisioning profiles are good for, I thought they were only useful for iOS. Has anybody successfully submitted a Mac app that uses AppTransaction?
4
4
1.2k
Apr ’23
StoreKit2: Transaction.currentEntitlements returns expired subscriptions (Testing locally with shortened sub periods)
Hi, title says it all: I have Transaction.currentEntitlements returning expired subscriptions (testing both transaction expirationDate & RenewalState). Environment: local via .storekit file. Subscription duration is shortened for testing. Could it be the issue? The sub duration is normally 1 year. The documentation says it should only returns active subscription (RenewalState.subscribed) or in grace period (RenewalState.inGracePeriod).
3
2
2.1k
May ’23
Tracking clicks on SKOverlay
I'm currently working with SKOverlay in my iOS app and I'm trying to track user clicks on the overlay. I've explored a few solutions but haven't been able to find a reliable method for capturing these clicks. I would appreciate some guidance or suggestions on how to achieve this. Any advice or code examples would be greatly appreciated. Thank you in advance for your help!
1
0
1.1k
May ’23
macOS TestFlight app using Xcode environment for IAP
I don't know how this happened or how to reset this, but I can't test the StoreKit part of my TestFlight app anymore. When I try to retrieve or buy products (IAPs), I get all kinds of strange behavior. I think it is caused by storekitagent thinking the app is in "Xcode sandbox environment". One of the errors from storekitagent looks like this: [51852D62] [LoadSubscriptionStatusTask]: Subscription status request failed with error - Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={AMSStatusCode=0, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <468756B3-DA53-4FED-B35C-E093954C27D8>.<1>, NSErrorFailingURLKey=http://localhost:49828/inApps/subscriptions?guid=98DD60024C21&reason=push, _kCFStreamErrorDomainKey=10, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <468756B3-DA53-4FED-B35C-E093954C27D8>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=http://localhost:49828/inApps/subscriptions?guid=98DD60024C21&reason=push, NSUnderlyingError=0x122f638d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _kCFStreamErrorCodeKey=-72000} It looks like it's trying to connect to a local server instead of contacting Apple's App Store servers. I'm on the latest macOS and Xcode. Any help is greatly appreciated:) Thanks!
5
1
1.8k
Jun ’23
Your payments from Apple are on hold.
Hey everybody, today I received an email (seemingly automated) stating that my payment is on hold due to irregular activity. However, I haven't violated any rules, and I've seen that many other people have received the same message. As soon as I saw the email, I contacted support via phone, and the representative who assisted me confirmed that my account status is correct and in good standing. She requested that I forward the email to her for further investigation. Email received: "We noticed some irregular activity associated with your vendor number XXXXXXXX and have paused your earnings payments while we investigate. Once our review is complete, we'll determine if we can resume your payments." Questions: Has anyone else experienced this issue? If so, what was the process to resolve it? How long does it typically take to have the payments resumed? Wishing you all a great day, Thank you.
4
2
2.2k
Jul ’23
StoreKit2 AppTransaction originalPurchaseVersion
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)?
1
0
569
Jul ’23
Is wallet extension an mandatory implementation for Apple Pay and Add to wallet?
I am working on a banking application (includes iPhone and iPad) which includes add to wallet feature. During the implementation I saw one document it is mentioned that for iPad app, the app must be extended to support Apple pay functionality. Details from document says "Card Issuers with an iOS mobile banking app must support Card Issuer iOS Wallet extension functionality to enable Card issuer mobile app customers to provision new cards directly from the iOS Wallet app with all eligible Apple iOS devices. If the Card Issuer has a dedicated iPad App, that App must be extended to support Apple Pay functionality. " Is wallet extension implementation required for Apple pay to work in iPhone and iPad? Is wallet extension a mandatory implementation for Add to Apple Wallet feature to work and approved by Apple? I am little confused in this. Anyone who integrated Apple pay or done add to Apple Wallet feature recently without wallet extension faced any rejection? Any help would be much appreciated.
4
2
3.3k
Aug ’23
How to cancel a subscription made by user in the TestFlight?
when we test in app purchase feature in TestFlight, we realize that TestFlight using our real iCloud account in AppStore, but because the app installed from TestFlight, they know it is still "Testing Phase" so they purchase set to FREE. Now im asking about how to test in app purchase for CANCEL SUBSCRIPTION? I can't found in my real iCloud account, either for my sandbox account inside AppStore settings. Please any response will helpful. Thankyou.
1
2
1.1k
Aug ’23
Transaction state gets `.purchased` even I set `SKTestSession.askToBuyEnabled = true`
I was trying to write unit test of ask to buy for SKDemo app. Even if I set SKTestSession.askToBuyEnabled = true, I got transaction state as .purchased after I call SKTestSession.buyProduct(identifier:). import StoreKitTest import XCTest final class SKDemoTests: XCTestCase { private var session: SKTestSession! override func setUp() async throws { session = try .init(SKTestSession(configurationFileNamed: "Products")) session.disableDialogs = true session.resetToDefaultState() session.clearTransactions() } func test() async throws { session.askToBuyEnabled = true try await session.buyProduct(identifier: "consumable.fuel.octane89") XCTAssertEqual(session.allTransactions().first!.state, .deferred) // Gets error here. The actual state I get is .purchased } } I was using Xcode 15.0.1 (15A507), Simulator iPhone 15 Pro iOS 17.0.1 (21A342) I couldn't find the problem so I'm happy to hear any solutions.
2
1
727
Oct ’23
StoreKit 2 - AppTransaction.originalAppVersion confusion
I've watched some of the WWDC session videos about this topic and read the documentation and header files, but it is still confusing... Because I change the pricing model of my iOS App (it was a paid App and now it will be a free App with an In-App purchase), I want to check if a user of my App purchased the App in the past. So user who have already paid in the past will get the full access without the need to pay the IAP, while new users would have to do this. In one of the WWDC videos exactly this topic was covered and the solution would be to check out AppTransaction.originalAppVersion. This would be a simple and easy solution... ...Unless I read the information from the header file and documentation for this API. Here it says: The string value contains the original value of the CFBundleShortVersionString for apps running in macOS, and the original value of the CFBundleVersion for apps running on all other platforms. The problem here is that when I check the Info.plist of iOS Apps, the CFBundleShortVersionString is used for the main App version and CFBundleVersion is used for the "build" number. According to the cited documentation from above, AppTransaction.originalAppVersion would be totally uselesss on the iOS platform, because it would only return the build number and not the version number. So I'm confused. Can I use AppTransaction.originalAppVersion to get the original version that was purchased for iOS Apps? If yes, the documentation must be wrong and misleading. If no, how can I do this? I'm currently in testing and I only get "1.0" as originalAppVersion within the beta release. This could be either because I really only get the useless build number, or I get the "real" version because the App is on the device since version "1.0" on my device, or it is just a limitation of XCode while testing that it is returning version "1.0" but would return the correct version when the App was installed from the AppStore.... Can someone bring some light into this topic? Am I missing something or did I understand something wrong?
2
4
1.2k
Nov ’23
How to cancel Auto-renewable subscription bought in TestFlight?
I've read several topics on cancelling subscriptions in sandbox environment, but it seems to me that it could not be applied to TestFlight. I can cancel sandbox subscriptions through Settings > App Store > Sandbox account But since TestFlight does not use sandbox account I cannot cancel a sub from there. Also, TF purchase does not appear in the list of regular subscriptions (Settings > Profile > Media & Purchases). So my question is: is there any way to manually cancel auto-renewable subscription bought in TestFlight build of the app?
5
5
4.1k
Dec ’23
Not receiving REFUND notifications in sandbox
Hi, I am following https://developer.apple.com/documentation/storekit/transaction/testing_refund_requests and trying to test refund requests. I am able to trigger refund requests from my app (in sandbox) using https://developer.apple.com/documentation/swiftui/view/refundrequestsheet(for:ispresented:ondismiss:) I do see that the notification URL receives a NotificationTypeV2.CONSUMPTION_REQUEST but it's not receiving NotificationTypeV2.REFUND The product for which the refund is triggered is a consumable type Is this expected behavior? How can I test REFUND without this? Thanks
4
0
1k
Dec ’23
Mac Appstore StoreKit 2 - validate purchase & where is purchase receipt cached?
This is re-posted from this Stack Overflow post. I am looking at validating the purchase of a paid app from Mac AppStore. Based on this WWDC video about StoreKit 2, I am attempting to this with AppTransaction. I have not found meaningful high-level documentation about this specific use case beyond that. My approach is to first get the "cached" AppTransaction by calling AppTransaction.shared. If that is not there I proceed to getting it from Apple, via AppTransaction.refresh(). If they don't have it, or when the network is down, the user automagically gets the familiar "log in to your store account" UI that has been around as long as the Mac AppStore. Once I have the AppTransaction I use it to verify we are on the right device, using code like this, where the returned Bool represents validation success: guard let deviceVID = AppStore.deviceVerificationID?.uuidString.lowercased() else { return false } let nonce = appTransaction.deviceVerificationNonce.uuidString.lowercased() let combo = nonce + deviceVID let digest = SHA384.hash(data: Data(combo.utf8)) return (digest == appTransaction.deviceVerification) My first question is: Does that look like the right approach? Is there something else I should do, or check? My second question is around testing this approach. Refreshing the AppTransaction in the sandbox invariably yields a valid item, even if the app version does not yet exist in AppStoreConnect. This is also the case when I log out in the App Store app on the Mac. This makes me think it is using my AppleID which I am logged into in System Settings. Does that sound right? I would like to be able to remove / delete the cached AppTransactions - where might I find those on the system? Thanks for everyone's help!
2
1
1.5k
Jan ’24
In-App Purchase:No Token Available When Expected.What is this token?
ERROR: 💰 Product purchase for '***' failed with error: Error Domain=RevenueCat.ErrorCode Code=2 "There was a problem with the App Store." UserInfo={source_file=RevenueCat/SKError+Extensions.swift:64, NSUnderlyingError=0x600000c91890 {Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x600000c68570 {Error Domain=ASDServerErrorDomain Code=1003 "No Token Available When Expected." UserInfo={NSLocalizedFailureReason=No Token Available When Expected.}}}}, readable_error_code=STORE_PROBLEM, NSLocalizedDescription=There was a problem with the App Store., source_function=asPurchasesError} And, I have also tested with SwiftyStoreKit and encountered the same issue.
5
0
1.1k
Jan ’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
490
Feb ’24
Physical or Digital Service for Competition Entry Fee?
I'm trying to figure out if my app will be required to use apple pay or not. My app features cycling competitions that take place over a month. There is no single race day so there is no physical event taking place. Instead, you're considered to be "in the event" every time you ride specific sections of road for that period of time. Unlike with, say, a telemedicine appointment, or a day-of race that you can't join if you don't have a ticket, there is no stopping you from riding your bike if you don't buy a ticket. The only difference is in whether you were riding as part of the event or not. The answer to this question will inform whether I take in-app payments or go with a 3rd party processor. Any guidance would be super helpful. Thank you!
0
0
328
Mar ’24
My Order on individual Apple Developer Membership reviewing 1 month and I didn't get an answer
My order reviewing 1 month and I didn't get an answer at all. During this period I have been trying different ways to get the subscription. I have tried different cards, different addresses and also I have tried to contact with Apple Support but I don't really understand why I can't complete this. there is an example what Apple Support answered me on message to help: Open this email on an iOS, iPadOS, or macOS device. Tap here to open the Apple Developer app from the App Store. Sign in to the app and follow in-app guidance to enroll. So when I download the app and follow the guidence I face grayed out button that didn't works and subtext: "Enrollment through the Apple Developer app is not available for this Apple ID. Visit: https://developer.apple.com/programs/enroll/" So this site is the site which answers me that my order will be reviewing during 2 business days. I am in the dead cycle where I can't pay my Program. Why? Pleas help me
0
0
547
Mar ’24
Status notification reception transition
We received a notification DID_FAIL_TO_RENEW(subtype:(Empty)) from App Store when the subscription failed to renew because of a billing issue. After this case, we predict that we will receive the notifications based on the following two cases. If the user resolves a billing issue: Receives notification DID_RENEW(subtype:(BILLING_RECOVERY)) If the user does not resolve the billing issue and cancels the subscription: Receives notification EXPIRED(subtype:BILLING_RETRY) Based on the above, I would like to ask two questions Are the above two cases and the notification types we expected correct? If wrong, please tell me what is wrong. If there are other than the above two cases, please tell me the case and notification type.
0
0
544
Mar ’24