StoreKit

RSS for tag

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

StoreKit Documentation

Posts under StoreKit tag

341 Posts
Sort by:
Post not yet marked as solved
5 Replies
1.5k Views
Suddenly in-app purchases of already productive IAPs are failing in the production with the error code: NSUnderlyingError=0x283b42e20 {Error Domain=ASDServerErrorDomain Code=3504 "找不到此项目。" UserInfo={NSLocalizedDescription=找不到此项目。}}} Environment: Production OS Version:iOS 15.6.1 I confirm that there have been no prohibited sales areas for the product I want to know What does Code 3504 represent? Where can I find documentation related to error codes?
Posted
by
Post marked as solved
5 Replies
4.8k Views
When I execute a restore on my in-app purchase I'm getting a warning, however the restore is successfully executed. I think this is something new with Xcode 14.3. My test device is running iOS 16.4 This is the warning: <SKPaymentQueue: 0x283708a80>: No observers found that respond to "paymentQueue:shouldAddStorePayment:forProduct:", will not check for purchase intents It fires at this point in the code. If I comment out the first line, I don't get the warning however, the restore doesn't execute. Is anybody else seeing this or do I have something wrong in my code? I know it's only a warning but any help would be appreciated. @IBAction func restoreButtonTapped(_ sender: UIBarButtonItem) { SKPaymentQueue.default().add(self) SKPaymentQueue.default().restoreCompletedTransactions() } I've included the rest of the code just for a completeness. func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { for transaction in transactions { switch transaction.transactionState { case .purchasing: //print("Purchase in progress...") break case .purchased: //print("Purchase Successful") SKPaymentQueue.default().finishTransaction(transaction) //print("Transaction Complete") // Hide the restore button navigationItem.setRightBarButton(nil, animated: true) //Set the BaseVerion in the Db to true IAPHandler.set_BaseVersion_To_Purchased() //Also hide the Purchase button UIView.animate(withDuration: 1.0, animations: { [weak self] in self?.purchaseButton.alpha = 0 }) { [weak self] (success) in self?.selector_Top_Constraint.constant = 30 } case .failed: if let error = transaction.error { let errorDescription = error.localizedDescription print("Transaction failed due to error: \(errorDescription)") } case .restored: SKPaymentQueue.default().finishTransaction(transaction) //print("Transaction Complete") // Hide the restore button navigationItem.setRightBarButton(nil, animated: true) // Set the BaseVerion in the Db to true IAPHandler.set_BaseVersion_To_Purchased() // Also hide the Purchase button UIView.animate(withDuration: 1.0, animations: { [weak self] in self?.purchaseButton.alpha = 0 }) { [weak self] (success) in self?.selector_Top_Constraint.constant = 30 } case .deferred: //print("Purchase Deferred") break @unknown default: if let error = transaction.error { let errorDescription = error.localizedDescription print("Transaction failed due to error: \(errorDescription)") } break } } } @IBAction func purchaseButtonTapped(_ sender: UIButton) { let theAlert = UIAlertController.init(title: K.Titles.pleaseChoose, message: nil, preferredStyle: .actionSheet) let theCancleAction = UIAlertAction(title: K.Titles.cancel, style: .cancel) let thePurchaseAction = UIAlertAction(title: K.DefaultList_Buttons.purchase_BaseVersion_Btn, style: .default) { [weak self] (action2) in if SKPaymentQueue.canMakePayments() { // User can make payments let paymentRequest = SKMutablePayment() paymentRequest.productIdentifier = self!.base_Product_ID SKPaymentQueue.default().add(self!) SKPaymentQueue.default().add(paymentRequest) } else { // User cannot make payments print("User cannot make payments") } } theAlert.addAction(thePurchaseAction) theAlert.addAction(theCancleAction) theAlert.setValue(NSAttributedString(string: theAlert.title ?? "", attributes: [.font : UIFont.systemFont(ofSize: (gDefaultTextSize - 2), weight: UIFont.Weight.semibold)]), forKey: "attributedTitle") let popOver = theAlert.popoverPresentationController popOver?.sourceView = sender popOver?.sourceRect = sender.bounds popOver?.permittedArrowDirections = .any present(theAlert, animated: true) }
Posted
by
Post not yet marked as solved
1 Replies
481 Views
Hello, I have a question regarding the presentCodeRedemptionSheet() function. I'm implementing an offer code input feature in a Unity app and currently testing it on TestFlight. However, when I tap the text field, the keyboard doesn't appear as shown in the attached image. If I flip the iPhone, the keyboard then shows up. Is this phenomenon specific to TestFlight or Sandbox? I am testing this issue on the following two environments, and the problem occurs in both cases. The iPhones are models sold in Japan. iPhone 11 Pro, iOS 16.4.1 iPhone 12 Pro, iOS 15.7.1 Any help or suggestions would be greatly appreciated. Thank you!
Posted
by
Post not yet marked as solved
2 Replies
1.1k Views
I'm trying to test my IAP subscriptions. Testing in the Sandbox environment has been kind of a nightmare, because it sometimes returns out of date information on the phone and the server events are either never delivered or delivered very late, etc. It makes testing nigh impossible. So I'm trying to test via TestFlight, because that is, at least, working in the production environment and delivers events more quickly and seems to return the correct data when I query the StoreKit2 APIs. However, it's using my REAL Apple Id for the purchases (no charges though), and after it has auto-renewed my subscription 12 times... then it NEVER will auto-renew ever again (as far as I can tell). Even if I resubscribe, the subscription immediately dies at the end of that period. It's making testing impossible again... and I can't find a way to clear TestFlight purchases similar to the way I can clear purchases for Sandbox users. At this point, I have -no- confidence that my Apple IAP Subscriptions are going to work correctly and I don't seem to have a way that I can test them properly in order to gain that confidence. Is there any way to clear purchases in TestFlight or any way to allow more than 12 renewals in TestFlight?
Posted
by
Post not yet marked as solved
2 Replies
1.7k Views
I am working on a billing implementation in UnityIAP. Recently, when I press the billing button on iOS, I get an Unknown error the first time, I checked the logs and found the following error. <SKPaymentQueue: 0x2823b65c0>: Error in remote proxy while processing transaction: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.storekitd" UserInfo={NSDebugDescription=connection to service named com.apple.storekitd}\ Special conditions, When this is occurring, addTransactionObserver is being called after the purchase order. If addTransactionObserver is called for a paymentQueue during the purchase process, would this error be called? Or if there is any problem on the AppleStore side, I would appreciate it if you could let me know. Thank you in advance.
Posted
by
Post not yet marked as solved
2 Replies
1.2k Views
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).
Posted
by
Post not yet marked as solved
1 Replies
586 Views
Hi! I can show the total yearly (or 6-month) auto renewable subscription price using displayPrice just fine, but I also want to show how much that would be per month, as I think its more enticing. I could just use price and divide by 12 (or 6), but then I wouldn't know how to show the local currency symbol next to the price. According to my googling this is easy to do in StoreKit 1 using SKProduct, but how do I do it in StoreKit 2 using Product? Thanks! PD: I'd also love to be able to test the different locales to make sure their prices/currency symbols are showing correctly.
Posted
by
Post not yet marked as solved
1 Replies
567 Views
I have set up an auto-renewing subscription that has a one month free trial. When using a Sandbox testing account and subscribing to the free trial, the trial lasts one month instead of the three minutes which I have configured. Is this a bug or is there a setting that I need to adjust to accelerate the subscriptions lengths for Sandbox users?
Posted
by
jh0
Post not yet marked as solved
3 Replies
611 Views
Good morning, we have a backend making calls to the subscriptions API to check the status of users subscriptions. Now, besides the check we need sometimes to extend subscriptions, using the api: https://api.storekit.itunes.apple.com/inApps/v1/subscriptions/extend/{originalTransactionId} To call this api we need a signed JWT Token and the originalTransactionId. Now, calling the api with the concrete parameters we receive always error response like this: StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Date: Wed, 17 May 2023 14:48:36 GMT Server: Apache Strict-Transport-Security: max-age=31536000 X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Security-Policy: default-src 'self' *.apple.com; X-Content-Type-Options: nosniff Content-Length: 196 Content-Type: text/html; charset=iso-8859-1 }; content is 404 Not Found Not Found The requested URL was not found on this server. Consider that the originalTransactionId is taken from the response of a previous verifyReceipt API, and the error does not seem related to the authentication (so I tend to exclude issues with the signed token) What could be the problem? What is the right way to extend a subscription via API call? Thank you.
Posted
by
Post not yet marked as solved
1 Replies
690 Views
I got this error while fetching products using storekit 2 in swiftui. 2023-05-23 12:19:51.196042+0530 SKDemo[1183:172700] [Default] Error enumerating unfinished transactions for first transaction listener: Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={client-environment-type=Sandbox, storefront-country-code=AUS, NSUnderlyingError=0x2812e0210 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://mzstorekit-sb.itunes.apple.com/inApps/v1/history?REDACTED, AMSStatusCode=500, AMSServerPayload={ errorCode = 5000001; errorMessage = "An unknown error occurred. Please try again."; okButtonString = OK; }, NSLocalizedFailureReason=The response has an invalid status code}}} 2023-05-23 12:19:58.672549+0530 SKDemo[1183:172693] [Default] Error enumerating all current transactions: Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={NSUnderlyingError=0x2812d5f50 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://mzstorekit-sb.itunes.apple.com/inApps/v1/history?REDACTED, AMSStatusCode=500, AMSServerPayload={ errorCode = 5000001; errorMessage = "An unknown error occurred. Please try again."; okButtonString = OK; }, NSLocalizedFailureReason=The response has an invalid status code}}, storefront-country-code=AUS, client-environment-type=Sandbox}.
Posted
by
Post not yet marked as solved
1 Replies
492 Views
I've got an app live in the App Store, and a second app that I'm developing right now. In TestFlight (only!), when I display a manageSubscriptionsSheet in the new app I'm seeing the TestFlight subscription status for the other app. If I run the new app on the same device in debug mode (connected to my laptop), I get the correct manageSubscriptionsSheet displayed. In both environments (Debug and TestFlight) I see the correct purchase sheet showing the right subscription options. It is only the manageSubscriptionsSheet that is incorrect. Both the new app and the old app (the one showing up in manageSubscriptionsSheet) have TestFlight builds on my phone. Of course, as I type this up I reinstall the TestFlight build (after seeing the correct manageSubscriptionsSheet in the debug build) and now I'm seeing the correct manageSubscriptionsSheet. Is this something I'm doing wrong in my app, or is this a known issue with TestFlight apps? I know it's expected that the entitlements are different on TestFlight than in debug, but would manageSubscriptionsSheet show something different than a purchase sheet?
Posted
by
Post not yet marked as solved
0 Replies
701 Views
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!
Posted
by
Post not yet marked as solved
1 Replies
612 Views
The app sells non-consumable in-app purchases. I also checked to enable family sharing. However, there are frequent cases where users share purchases using the family sharing function and fail when attempting to purchase or restore from a device of the shared account. Or, if a user who received the sharing makes a purchase, it will not be processed as shared payment information, but will be paid with the payment registered with the Apple ID of the current device. I used StoreKit2 and use Transaction.currentEntitlements to get payment info after purchase or restore. However, non-consumable in-app purchase information that has been shared with the family does not arrive normally. When I looked at the Storekit2 documentation, I know that there is nothing special handled or added in the API or code related to family sharing. If I'm wrong on this part or if you know a good solution to this non-consumable payment - family sharing, please advise.
Posted
by
Post not yet marked as solved
0 Replies
504 Views
I’m trying to build a simple app that will allow users to create items in-app and buy/sell access to them. Users can buy tokens from the App Store that can be used to fund these purchases (e.g. 1 token = 100 coins), and can also be used support the development of these items (e.g. give creator 1 coin a week). The creators can then cash out the coins once a certain amount is reached, via Stripe or some other external payment provider. Is this allowed under the current rules of the app store? Is it possible to implement using CloudKit? If this isn’t allowed, is it possible to allow users to share content on the app’s “store” for other users to browse and download, and can that be done just using CloudKit? This is my first-ever app and I don’t know left from right when it comes to back-ends. I will greatly appreciate any pointers.
Posted
by
wmk
Post not yet marked as solved
1 Replies
821 Views
So trying to release a new (iOS/iPadOS) app and I'm in endless rejection purgatory trying to get it approved along with its first In App purchase product (an auto-renewable subscription). This is the final issue holding back the release and I do not know how to get out of this rejection loop. First, yes, In App purchase works fine when testing in the sandbox environment. My In App purchase infrastructure is based on the well-regarded StoreHelper Swift package and works great in all my testing. The rejection is based on the fact the "store" in my app always displays an empty products list when Apple reviews the app. Of course, since they haven't approved my lone subscription product, which has a status of 'Waiting for Review' I'm not surprised they see an empty store, but Apple is apparently surprised and refuses to stop being surprised. All they do is toss a link to the StoreKit documentation at me. So I pore over it looking for clues. Hmm. Hmm. Yeah I know this, I do this, what are you not telling me? So I'm climbing the walls trying to figure out if indeed I'm overlooking something. Apple, like a pedantic college professor, apparently wants me to figure out on my own. Well I can't. I can't find the secret handshake. So questions: When I create my .storekit configuration file I do so by syncing with my App in App Store Connect. This works dandy, but do I or do I not include this configuration file with the distribution build I submit for review? I can't find any info on whether this is only for testing or for both production and testing, and since I have to manually add it to my project after creating it, I worry that's not how it's intended to be used. So do I add the .storekit bundle to my app target and leave it there during distribution? (Note: I already do so, wondering if I should not) Since I'm using fastlane to produce and upload my builds, how can I be sure this StoreKit Configuration is being set correctly (right now I use the pop-up in the Options tab of my Release scheme)? Does it even need to be set when distributing? I assume so. Apple has this strange ambiguous language about "your first In App purchase must be submitted with a new build". Well, early on there was indeed a way to add my not yet approved Subscription product with the build review request, but now that's gone. So I have this subscription product sitting in "Waiting for Review", I have my working app that can't get approved because it can't see the not yet approved subscription product. Though maybe it can't see it for reasons other than it's not approved yet. Do I just... wait and hope Apple eventually moves my Subscription product to an approved status and submit again? At my wits end as this is now rejection round 6. I've heard horror stories of similar first In App purchase doom loops going a dozen or more rejection rounds. Developing the app was hard enough but to be stuck in this maddening bureaucracy is killing me. Many thanks in advance!
Posted
by
Post not yet marked as solved
0 Replies
281 Views
I understand we do not get to know if SKStoreReviewController(SKSRC) was show and how the user interacted with it. Is system(iOS/iPadOS) putting checks in place so that in same app version, SKSRC is not shown to a user again if user has already rated(or rated + reviewed) the app earlier in same version via SKSRC? If system can show SKSRC again to users who have rated( or rated + reviewed) in same app version then in the 2nd instance of SKSRC will the rating stars and the review be pre filled with first instance SKSRC response?
Posted
by
Post not yet marked as solved
1 Replies
288 Views
Hi team, I tested the purchase flow under different country. I logged in store sandbox as a Japan account. I can get the product list result which shows $1200 monthly which match the price mapping in AppStore console even my App only enabled Canada and United State in Appstore connect . Purchase this product is also success in sandbox. why purchase is success can you help me understand what else we need to do ?
Posted
by
Post not yet marked as solved
0 Replies
296 Views
Is there a way to get a transaction by the transaction ID? I understand that there is a way to get the latest transaction for a specific product ID, but that isn't helpful when attempting to look up a specific transaction. The reason for this is that once a purchase is made and verified on the client device, a request is made to a backend server to do some extra validation and to provide the user with the required entitlement for that purchase. Once the server completes this, it responds to the client, and the client app needs to look up the transaction in order to call finish() on it. Would it make sense to get the unfinished transactions and loop through them to match the required transaction ID? What I'm referring to is this: https://developer.apple.com/documentation/storekit/transaction/3856631-unfinished Another question, is it possible for there to be more than one unfinished transaction for the same product?
Posted
by