StoreKit Test

RSS for tag

Create and automate tests in Xcode for your app's submission and in-app purchase transactions.

Posts under StoreKit Test tag

81 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

In-App Purchase Transaction Handling and Refund Implications in App Store API
Hello, I am currently encountering an issue while using the server-side API for in-app purchase integration. Suppose a user has already purchased a product, and the App Store returns a transactionId of 1. After some time, the user repeats the purchase for some reason, and the App Store returns a transactionId of 2. However, when I use the Get Transaction History interface to query the transaction information for transactionId 2, I see that the data returned by the App Store does not include the transaction data for transactionId 2; it only contains the transaction data for transactionId 1. In this situation, my guess is that when the user makes a repeat purchase, the App Store recognizes that the user has already purchased the item and has not executed a refund. Therefore, the App Store generates a new transactionId for this request (the user's purchase) and associates it with the previous purchase's transaction data. This is my inference. If this user has made 5 repeat purchases, when the user successfully requests a refund, if I query the transaction information through the Get Transaction History interface, will the revocationDate for all 5 transactions in the App Store's official database be modified to the same date? Additionally, after the user successfully refunds and makes another purchase, will the new transactionId still be associated with the previous transaction data?
0
0
111
1w
Implementing In-App Purchases for the first time
Hi, I want to apply in app purchases in my app. I have set it up in xcode and on appstoreconnect, it is saying ready to submit. I dont understand what i need to do now to connect the two. I have read i need to send my app for review for them to be reviewed, but i want to test the in app purchases first on test flight and on sandbox before i send my app for review. Please can someone clarify for me and help me?
1
0
139
2w
InApp Subscription list not loading in release build
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.
1
0
162
4w
Storekit2 not providing a stable experience in sandbox mode
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?
0
2
223
4w
iOS OfferCode testing in outside the app .
In my app, I need the user to redeem a code outside the app and then capture the transaction in the callback/response from the App Store. How can I test this process? Here's my function for opening a URL: if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } } I am trying to get the transaction object in the TransactionObserver class: // Implementation details... } Here is the link to this class. However, I am not receiving the expected callback in this observer. I am testing on a TestFlight build. My question is: Is it possible to test offer codes in TestFlight? Or is there something wrong with my implementation?
2
0
175
2w
Testing .pending Status of Product.purchase(options:) in StoreKit2
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.
0
0
148
Oct ’24
Issue with In-app system disclosure sheet
We are utilizing the StoreKit external purchase link within the app and have configured the necessary keys in the entitlements according to the documentation. The Info.plist file has also been updated with the required key and a single destination URL, following the guidelines from this documentation. However, when we click the link in the app, it redirects to the default browser, and the in-app system disclosure sheet does not appear. Should the in-app disclosure sheet appear automatically, or do we need to design and implement it ourselves?
0
1
191
Oct ’24
Apple silicon Macs support issue
After building the app for TextFlight, I uploaded it. After that, I initially received the following message via email. "ITMS-90899: Macs with Apple silicon support issue - The app isn‘t compatible with the provided minimum macOS version of 11.0. It can run on macOS 12.0 or later. Please specify an LSMinimumSystemVersion value of 12.0 or later in a new build, or select a compatible version in App Store Connect." So I added "LSMinimumSystemVersion" to info.plist, increased the version, and uploaded it again. Next "ITMS-90863: Macs with Apple silicon support issue - The app links with libraries that aren’t present in macOS: /usr/lib/swift/libswiftCloudKit.dylib @rpath/libswiftCloudKit.dylib" I received an issue email like the above. The app has supported Mac (Designed by iPad) so far. This time, this issue occurs after building in Xcode 16.0 / MacBook OS 14.6.1. The app being built supports at least iOS 14. We cannot uncheck it because we must support "Mac (Designed by iPad)" in the future. This issue did not occur in the initial upload and distribution. It occurred after deleting all files in the ~/Library/Developer/Xcode/DerivedData path and rebuilding the project. Is this an Xcode bug that will be fixed in the next update? Or is there a separate solution?
11
15
5.0k
1d
Apple In App Purchase Validation through Server Notification
We are currently experiencing an issue where our server is not receiving Apple’s server notification (webhook) for in-app purchase confirmations. This notification is critical as it helps us confirm the purchase status and fulfill the corresponding services to the users. Despite the successful completion of purchases within the app, the lack of webhook notifications prevents us from tracking and processing these payments on our backend. In addition to resolving this issue, we are also concerned about the security aspect of receiving server notifications. Specifically, we want to ensure that any requests or notifications we receive are indeed coming from Apple, and not subject to potential man-in-the-middle (MIM) attacks. We are looking for information or best practices on how to validate that the request originates from a legitimate Apple source, ensuring the integrity of the communication and safeguarding our system from spoofed or malicious requests. Key questions: Server Notification Issue: Why might we not be receiving Apple's payment confirmation notifications, and what steps can we take to troubleshoot this issue? Request Validation: What security mechanisms or validation techniques can we implement to confirm that the server notifications are genuinely from Apple, ensuring no interference from MIM attacks? Does Apple provide any headers, tokens, or signatures in the server notification that we can use to verify the origin? Are there any known methods or configurations to ensure secure receipt of in-app purchase confirmations? We are looking for guidance and possible solutions to ensure a secure and reliable payment validation process for our in-app purchases. Any support in this regard would be highly appreciated.
0
0
187
Oct ’24
Xcode's default macOS Deployment Target is 11 which causes Testflight submission warning
If a new (iOS) project is created in Xcode then a default set of deployment targets and values gets automatically created and set as follows: If the iPad, Mac, and Apple Vision supported destinations are deleted from the Xcode general section, these deployment targets still remain. If the app is then built using Xcode 16 and uploaded to TestFlight/App Store then the following issue is reported: TMS-90899: Macs with Apple silicon support issue - The app isn‘t compatible with the provided minimum macOS version of 11.0. Why is XCode populating the macOS deployment target with a value that that results in this issue? Why is Xcode even populating all 6 of these targets at all when its for an iOS app and hence 5 of them are redundant? Can the macOS deployment value simply be increased to silence this issue? Or can these that aren't relevant to iOS be deleted (if so how)? TIA
0
0
367
Oct ’24
Help with SKTestSession Setup - ASDErrorDomain Code 505 Error
Hello everyone, I’m having trouble configuring SKTestSession for StoreKit testing in my UI tests. Specifically, I’m encountering the ASDErrorDomain Code 505 error when trying to set the storefront and locale in my test configuration. Despite following the setup steps, I keep getting errors indicating that the storefront and locale cannot be set, and the transactions are not being processed correctly. Here are the error messages I’m seeing: [SKTestSession] Error saving configuration file: Error Domain=ASDErrorDomain Code=505 "(null)" [SKTestSession] Error setting storefront to JPN for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)" [SKTestSession] Error fetching the current storefront: Error Domain=ASDErrorDomain Code=505 "(null)" [SKTestSession] Error setting value to ja for identifier 4 for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)" [SKTestSession] Error fetching value for identifier 4 for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)" These errors suggest that SKTestSession is unable to save or apply the configuration properly, but I’m not sure why. I’ve tried various storefronts and locales, but the issue persists. I’m running this on Xcode 16.0 (16A242d) on macOS 14.7 and 15. Below is the code for the setUpSession function I’m using to configure the session: func setUpSession(configuration: String = "Configuration", storefront: String? = nil, localeIdentifier: String? = nil) throws -> SKTestSession { var session: SKTestSession! try XCTContext.runActivity(named: "Set up subscriptions for \"\(configuration)\" storefront: \"\(storefront ?? "")\" and locale: \"\(localeIdentifier ?? "")\"") { activity in session = try SKTestSession(configurationFileNamed: configuration) if let storefront { session.storefront = storefront } if let localeIdentifier { session.locale = Locale(identifier: localeIdentifier) } session.disableDialogs = true let info = XCTAttachment(string: "storefront: \(session.storefront)\nlocale: \(session.locale.identifier)\ntransactions: \(session.allTransactions().count)") info.name = "Session configuration" activity.add(info) XCTAssertEqual(session.storefront, storefront, "Failed to set storefront") XCTAssertEqual(session.locale.identifier, localeIdentifier, "Failed to set locale") } return session } What I’ve Tried: Ensuring that storefront and locale values are valid. Resetting StoreKit configuration in Xcode’s scheme settings. Deleting derived data and restarting Xcode. Testing with different values for storefront and locale. Has anyone encountered similar issues with ASDErrorDomain Code 505, or can anyone point out what might be causing this? Any help would be greatly appreciated! Thank you!
0
3
313
Oct ’24
StoreKit Testing with different Country Codes
I am writing unit tests that change the country by setting the .storefront property of SKTestSession to different country codes. I have made sure that the country codes I am using are indeed valid based on ISO 3166-1 alpha-3 region code standards. My default storefront in the StoreKit Configuration file is "USA" but in the unit test, I set it to say "IND" and it runs my test. In the production code, when I print await Storefront.current?.countryCode, I indeed get "IND" as expected. Now when I change the value to say "RUS" by assigning it to the SKTestSession instance, the printed value in production code is still "IND" from the previous assignment. If I call .resetToDefaultState() on the session after first test passes with "IND", it defaults to "USA" but when I set it to "RUS" in my test after it, it stays on "USA". Basically the value does not change after the first change and calling reset resets it to configuration file default but reassigning a new value has no effect on Storefront. What am I doing wrong? Btw, I have tested with both XCTest and Swift Testing but the testing framework has nothing to do with this issue. I am on Xcode 16, macOS 15, Swift 6
3
0
314
2w
Subscription Issue: "Ready to Submit" Subscriptions Not Loading Without StoreKit File in TestFlight
Hello, I'm experiencing an issue with subscriptions in my app, which hasn't been approved yet. I created the subscriptions in App Store Connect and can successfully sync them using a StoreKit file in Xcode. When I test the app on my device with this file, everything works fine – the subscriptions load, and I can simulate purchases without any issues. However, when I submit the app to TestFlight or even when I test it on my device without the StoreKit file, the subscriptions are not found by their IDs, even though they are marked as Ready to Submit in App Store Connect. If my StoreKit file can sync with App Store Connect, why am I unable to retrieve the subscriptions directly when compiling the app without this file? This makes it challenging to understand if the subscriptions are properly set up in the App Store. Any help would be greatly appreciated!
2
0
303
Sep ’24
Issue with Subscriptions during App Review
Hello, I’m facing an issue with the subscriptions in my app during the review process. When I test the app in Xcode using a StoreKit configuration file, I can see and purchase the subscriptions without any problems. Testing with a Sandbox user in TestFlight also works fine – I can see and purchase the correct subscriptions. However, my app was rejected during the review because the reviewer said the "Try for Free" button wasn’t working. In the screenshot, I noticed that the subscriptions didn't load and it showed dummy data instead. This issue only seems to happen during the review. When I test the app in both TestFlight and the Xcode simulator, everything works perfectly. I can see the subscriptions, purchase them, and the app runs as expected. Could you please help me understand why this issue is happening during the review, even though everything works fine on my end? Also my banking information are ok and complete. Thank you very much!
3
1
288
Sep ’24
Getting different StoreKit results between SandBox and StoreKitTransactions in Xcode
I’m using ‘Offer Codes’ in App Store Connect for subscriptions. I’m also using a StoreKit implementation that uses the subscriptionStatusTask modifier to assess if the user is subscribed or not. The part I’m not sure of is whether or not the subscriptionStatusTask modifier will recognize the status if the user has used an offer code. I think it should, as that modifier checks for currentEntitlements, and returns appropriately. I’ve been trying to test this out with the StoreKitTransactions system in Xcode, as SandBox does not currently support this. From what I can tell, this way does in fact seem to allow the user to access the app with an offer code. The app does not present the StoreKit view. However, when I’ve tried this with an actual user on the app store (aren’t mom’s great?), the offer code does not take, and they are presented with that StoreKit view. Not great. So can someone please shed some light on this? Is my understanding correct here? What else do I need to do?
0
0
265
Sep ’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