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

80 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

IAP Sandbox - No Products
Hello, I've been trying to get the sandbox environment working for in-app purchases, but so far, no luck. I can use a storekit config file to simulate purchases just fine. The item is a single consumable product. I've checked that my product ID matches, followed the advice tendered to other forum users, created a sandbox user, all to no avail. I've signed into the app store using my sandbox account on one phone - I can't get the "Sandbox User" option to appear on the second after attempting to make a purchase (per https://developer.apple.com/documentation/storekit/testing-in-app-purchases-with-sandbox ). What I'm wondering is, do I need to get the in-app-purchase approved/released through App Review before I can even perform testing or something? I've signed all agreements, set up our banking information, everything seems to be in order, but I just cannot get the StoreKIt products call to return anything. ( let products = try await Product.products(for: productId) ) Is there anything else I can check? I've also checked everything here: https://forums.developer.apple.com/forums/thread/652077 Thanks!
1
0
140
1w
Unable to retreive transactions history or Info (StoreKit2)
Hi everyone, I’m currently integrating auto-renewable subscriptions in my React Native app, and I’m encountering an issue with the StoreKit2 API. What Works I’ve successfully implemented in-app purchases, and I can purchase auto-renewable subscriptions without any issues. After the purchase, I’m receiving the following transaction details: ``{ "originalTransactionDateIOS": 1732733802000, "originalTransactionIdentifierIOS": "2000007891139879", "productId": "product.id", "transactionDate": 1732748202000, "transactionId": "2000007935522994", "transactionReceipt": "xxxxxxxxxxxxCwIBAwIBAQ" }`` The Problem When I send the transactionId to my server and call either getTransactionHistory or getTransactionInfo using the App Store Server API, I always receive an empty array as the response. Additionally, I’ve tried testing with StoreKit Testing in Xcode, but I consistently get 0 as the transactionId, which makes it impossible to verify the transactions. Here’s what I’ve done so far: I’m using a sandbox account for testing. The subscription purchase flow works, and the transactionId is successfully retrieved in the app. I’ve double-checked that the transactionId sent to the server matches the one from the app. Thanks in advance!
0
0
111
2w
How get the backend service get the fefund amount in the subscription plan "Upgrade" cases?
If a user applies for and is approved for a subscription refund by Apple, we understand that the developer can receive a server notification of "REFUND." However, this notification doesn't include the refund amount. Therefore, we thought about linking the refund amount information output in the financial report "All Countries or Regions (Detailed)" with individual end-user transaction information. However, it seems that this report doesn't have a transaction ID, and the records appear to be aggregated daily. Is there any way we can find out how much was refunded to which user for individual refunds? If a user applies for a subscription refund from Apple, are there cases where only a part of the plan, rather than the full amount, is refunded?
0
0
85
2w
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
209
Nov ’24
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
218
Nov ’24
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
222
Oct ’24
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
335
Oct ’24
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
262
Nov ’24
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
221
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
242
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?
12
15
5.4k
3w
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
263
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
436
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
421
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
384
Nov ’24
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
383
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
346
Sep ’24