StoreKit Test

RSS for tag

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

StoreKit Test Documentation

Posts under StoreKit Test tag

67 Posts
Sort by:
Post not yet marked as solved
3 Replies
1.1k Views
When calling SKPaymentQueue.default().restoreCompletedTransactions() during unit testing it always fails. It calls the restoreCompletedTransactionsFailedWithError with an error message: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSLocalizedDescription=The network connection was lost., NSUnderlyingError=0x600000eb2790 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSErrorPeerAddressKey={length = 28, bytes = 0x1c1ef212 00000000 00000000 00000000 ... 00000001 00000000 }}}} This is/was working fine in iOS 16 and Xcode 14. Anyone else seen this issue?
Posted
by YishaiR.
Last updated
.
Post not yet marked as solved
11 Replies
6k Views
Hi, thanks for reading my question. I need help with some odd behaviour with product.purchase() not triggering a confirmation dialog after a subscription has expired and trying to purchase it again. Seeing this in iOS 16.2 and 15.7.2 (haven't tried any other versions) on actual devices, not in simulator. I'm using a sandbox user on the sandbox environment (not using the local store kit config file testing option). Using a newly created sandbox user, first subscription purchase goes through just fine, dialog box pops up, login with sandbox user, get confirmation of purchase and then Transaction.currentEntitlements has one item as expected. It auto renews for 12 times (each time Transaction.currentEntitlements contains the correct results) and then expires, as expected for sandbox. Transaction.currentEntitlements is then also empty, as expected. All good so far. Now I want to test purchasing it again...Call product.purchase() again to renew/start a new subscription and nothing happens, no confirm purchase dialog box pops up at all. The purchase function simply exits BUT returns success (as in the following gets called) but in self.updatePurchasedProducts(), Transaction.currentEntitlements is empty. case let .success(.verified(transaction)):      // Successful purchase       await transaction.finish()      await self.updatePurchasedProducts() if I instead go to Settings->App Store->Sandbox User-> Manage Subscriptions and renew the subscription there, instead of in my app, then Transaction.currentEntitlements has a new entry and all is good again. Alternatively, if I create yet another new sandbox user and logout of the old one I was using, I am once again able to purchase from within the app, so .purchase() once again works as normal. Is there something I am missing about expired subscriptions and trying to purchase them again in the app? Is this a sandbox issue and in production I'll have no problem? The sandbox user has purchasing enabled in Settings->App Store. I've also tried calling AppStore.sync() (which is in my "Restore Purchase" button) before calling product.purchase() after the subscription stops renewing, expires and this issue comes up, doesn't resolve it. Also have a less important question, the initial call to product.purchase(), the one that works as expected, has a bit of a delay before the confirmation dialog pops up, a few seconds, which will probably result in the user clicking the buy button again thinking it didn't work. Is a bit of a delay normal for sandbox? Will it be ok in production? When it fails, and I have to renew in Settings->AppStore->Sandbox user, there's also a bit of a delay after I return to my app, 5-15 or so seconds, before the transaction observer fires and currentEntitlements is checked again, is there a way to reduce this delay? Thank you! Colin @MainActor class IAPManager: NSObject, ObservableObject {  // removed other functions.....   func purchase(_ product: Product) async throws {    let result = try await product.purchase()     switch result {    case let .success(.verified(transaction)):      // Successful purchase       await transaction.finish()      await self.updatePurchasedProducts()    case let .success(.unverified(_, error)):       break     case .pending:       break     case .userCancelled:       break     @unknown default:       break   } }  func updatePurchasedProducts() async {     for await result in Transaction.currentEntitlements {       guard case .verified(let transaction) = result else {         continue       }       if transaction.revocationDate == nil {         self.purchasedProductIDs.insert(transaction.productID)       } else {         self.purchasedProductIDs.remove(transaction.productID)       }     }   } }
Posted Last updated
.
Post marked as solved
1 Replies
820 Views
Been testing all day and receipt loading has been working (testing in sandbox) on Mac Catalyst. I'm using StoreKit1. All of a sudden I'm getting the following error when refreshing a receipt: ** Error Domain=AMSErrorDomain Code=203 "Bag Load Failed Unable to retrieve app-receipt-create because we failed to load the bag." UserInfo={NSDebugDescription=Bag Load Failed Unable to retrieve app-receipt-create because we failed to load the bag.** Sandbox server down?
Posted Last updated
.
Post not yet marked as solved
1 Replies
606 Views
Dear anyone, especially for Apple Teams, we produce an issues when re-testing our app using sandbox environment. When purchasing an in-app-purchase subscription process completed, an error show up like below. <SKPaymentQueue: 0x2837755c0>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={NSUnderlyingError=0x283ad66d0 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://sandbox.itunes.apple.com/WebObjects/MZBuy.woa/wa/inAppBuy?REDACTED, AMSStatusCode=500, NSLocalizedFailureReason=The response has an invalid status code}}, storefront-country-code=IDN, client-environment-type=Sandbox} Please any help, thankyou.
Posted
by hifella.
Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
Hi, We manage in-app purchases/subscriptions and their notifications in an server-to-server setup. We currently updated one of our devices to iOS 17. The sandbox subscription management is still not working, we encountered the same issue on iOS 16. When trying to access the sandbox subscription management menu, the authentication steps works correctly, but after that we get a error screen with the message: Cannot Connect. There is a retry button, but the same error message is prompted, after it is pressed We have this working on devices which have iOS 15.x versions. Are there any investigations or updates on this subject? Are there any workarounds to make this work? Thanks, David
Posted Last updated
.
Post not yet marked as solved
5 Replies
1.2k Views
When attempting to sync storeKit configuration from App Store Connect, an error message stating 'An unknown error occurred when syncing from App Store Connect' is displayed. Xcode: Version 14.3.1 (14E300c) App BundleID is same with setting in App Store Connect.
Posted
by Kangnux.
Last updated
.
Post not yet marked as solved
0 Replies
467 Views
Using a modified version of the following example var body: some View { NavigationSplitView { BackyardList(isSubscribed: isSubscribed, backyardLimit: passStatus.backyardLimit, onOfferSelection: showSubscriptionStore) .navigationTitle("Backyard Birds") .navigationDestination(for: Backyard.ID.self) { backyardID in if let backyard = backyards.first(where: { $0.id == backyardID }) { BackyardTabView(backyard: backyard) } } } detail: { ContentUnavailableView("Select a Backyard", systemImage: "bird", description: Text("Pick something from the list.")) } .sheet(isPresented: $showingSubscriptionStore) { SubscriptionStoreView(groupID: groupID) } .onInAppPurchaseCompletion { _, purchaseResult in guard case .success(let verificationResult) = purchaseResult, case .success(_) = verificationResult else { return } showingSubscriptionStore = false } } (from Apple's sample code demonstrating in-app purchases), I'm unable to complete a sandbox purchase on Apple Watch. I get the error in the UI Unable to Purchase App Sign in with your Apple ID from the Apple Watch app on your iPhone and printing purchaseResult outputs failure(StoreKit.StoreKitError.unknown). An Apple ID is signed into Settings on iOS, as well as the Apple Watch app. This occurs whether or not a separate sandbox Apple ID is signed into Settings under App Store. The subscription options UI appears as expected before attempting to purchase one.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
test - https://developer.apple.com/forums/content/attachment/0233d5fd-a2cf-4ac3-843c-b1ce58672dab linkText<script> - https://www.example.com/
Posted
by mclovin01.
Last updated
.
Post not yet marked as solved
1 Replies
818 Views
Issue 1: When testing iOS subscriptions with StoreKit 2 in a sandbox environment on iOS 16.2 / Xcode 14.2 with a Sandbox Tester Account on a real device, I encountered a strange problem. The first 5 subscription renewals worked correctly, but after that, it didn't renew, and I received the following notification: 'notificationType': 'EXPIRED', 'subtype': 'VOLUNTARY'. According to the App Store Server documentation, this subtype indicates that the subscription expired after the user disabled subscription auto-renewal. However, I did not manually disable Auto-Renewal. Issue 2: After a subscription expires and is not renewed, attempting to re-subscribe doesn't show the confirmation dialog and returns success without any error message. The transactionId is the ID of the expired subscription. However, if I switch to a different productId plan, such as switching from a monthly payment plan (which doesn't show the dialog) to an annual payment plan (which does show the dialog), it works as expected. I found a similar case on the Apple Developer forums: https://developer.apple.com/forums/thread/723126, but the provided solutions didn't work for my situation. Hope you guys can help me out.
Posted
by 747604.
Last updated
.
Post not yet marked as solved
3 Replies
1.5k Views
import StoreKitTest try SKTestSession(configurationFileNamed: "Configuration") Xcode Version 14.1 (14B47b) iOS14.* Configuration.storekit file created when running this test code will testing failed, can anyone tell me how to solve this problem? iOS15 and iOS16 is no problem Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle *** Underlying Error: The bundle *** couldn’t be loaded because it is damaged or missing necessary resources. The bundle is damaged or missing necessary resources. Try reinstalling the bundle *** Reason: Incompatible library version: StoreKitTest requires version 1.0.0 or later, but XCTest provides version 0.0.0))
Posted
by yyabu.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
As indicated on the website below the sandbox should now have a SHA-256 signature for new purchases starting on June 20, 2023 for apps running in iOS 16.6 and higher. I tried with iOS 17 beta, still getting a SHA-1 signed receipt. Has anybody managed to get a SHA-256 signed receipt? TN3138: Handling App Store receipt signing certificate changes | Apple Developer Documentation
Posted Last updated
.
Post not yet marked as solved
10 Replies
1.9k Views
We add some new consumable in-app purchase items in our game. These items has submitted and became available in iTune Connnect like other elder items. But when I test purchasing in the game, just got a pop up window shows 'Purchase of this item is not currently available This item is being modified. Please try again later'. It might went through when I try again sometimes yesterday, but it never success today. This it's not releative to iCloud backup or relogin App Store account, I have tried but not working. I though it's Apple's serverside bug. Please help me to fix this.
Posted
by JD_Chen.
Last updated
.
Post not yet marked as solved
2 Replies
925 Views
When I test the sandbox payment, Apple often prompts me the following error: &lt;SKPaymentQueue: 0x280602000&gt;: Payment completed with error: Error Domain=ASDServerErrorDomain Code=2040 "目前無法購買此項目" UserInfo={NSLocalizedDescription=目前無法購買此項目} device infomation: iPhone X, iOS 14.4; Xcode 14.2
Posted
by nianxin.
Last updated
.
Post not yet marked as solved
3 Replies
668 Views
I have implemented in-App purchases in my existing App, In-App Purchase Product Status: Ready To Submit All banking and tax-related information is set in App Store Connect. it is more than 24 hours, I am Facing the Error: # Purchase of this item is not currently available This item is being modified. Please try again later. [Environment: Sandbox ] Thank you
Posted Last updated
.
Post not yet marked as solved
1 Replies
655 Views
I'm building app for iOS with flutter and I encountered some problem implementing the IAP function. What I Encountered I made a purchase in simulator. The product list was load successfully, the storekit poped up, and I finished purchase successfully as well. But I cannot see transaction detail in the Storekit Manager in xcode, neither can I see notification send from Apple. I'm sure I configured the server URL in App Store Connect, and both chose V2. I'm sure I enabled Storekit in Edit Scheme, and sync with App Store Connect My server can receive Test Server Notification. What I Expected I want to receive the notification from Apple when make purchase from both develpment(simulator) and production(physical device). Otherwise I cannot verify the user's purchase.
Posted Last updated
.
Post not yet marked as solved
2 Replies
1k Views
Hello everyone, I am writing to inquire about a strange behavior that I encountered while using StoreKit 2 on watchOS 9.1 and Xcode 14.2. Specifically, when using the Transaction.currentEntitlements method, it returns refunded non-consumable purchases alongside valid ones. Additionally, I have observed that Transaction.updates does not notify me of refunded purchases or cancelled subscriptions while testing on my local environment with Xcode. When implementing the same code with an iOS app, it works as expected, indicating that this may be a watchOS-specific issue. This behavior is unexpected, and I am unsure if this issue also occurs in a production environment. Can anyone please help me with this issue? Thank you in advance.
Posted Last updated
.
Post not yet marked as solved
0 Replies
600 Views
Can I delete the file StoreKitTestCertificate.cer if I have a published app that uses StoreKit 2? This is how I was using it earlier to do receipt validation but it's no longer in my released app: #if DEBUG let certificate = "StoreKitTestCertificate" #else let certificate = "AppleIncRootCertificate" #endif Source: https://developer.apple.com/documentation/xcode/setting-up-storekit-testing-in-xcode/ Can I safely delete StoreKitTestCertificate.cer in my next version this file without affecting the released app or TestFlight?
Posted
by awal.
Last updated
.
Post not yet marked as solved
0 Replies
580 Views
So, I have a party finder app, where people will be able to set up their own parties, and here it comes, set up a price. So, now that the app is posted other users will be able to pay the ticket cost and receive their digital ticket. This is using the base StoreKit by the way. Thats all good, now here comes were I am confused, I want to make it so people can receive money as well. StoreKit doesn't allow to send money to the persons account right? So what Im planning is instead making it so all the money is sent to my bank account, and then manually in my bank account I send the money to the party creators. I would of course also ask for a bank account number to know where to send the money. Now is this allowed?
Posted
by New007.
Last updated
.
Post not yet marked as solved
0 Replies
658 Views
Is there a way to get previews to load products from the configuration file? I tested in both our own app and in the SKDemo app, appears that the StoreView is empty and not products are loaded in previews. The products loads fine form the config file when running the demo app in the simulator.
Posted
by EmilGG.
Last updated
.