StoreKit

RSS for tag

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

StoreKit Documentation

Posts under StoreKit tag

342 Posts
Sort by:
Post not yet marked as solved
0 Replies
42 Views
HI, Where i can get free trial days for the each plan. i have check with production information as well as in the "https://sandbox.itunes.apple.com/verifyReceipt" url i couldn't find in both. Kindly help me to find out.
Posted Last updated
.
Post not yet marked as solved
0 Replies
51 Views
When performing StoreKit 2 operations in my Mac app, even very simple ones like AppStore.sync() a small but steady percentage of users experiences the following error: systemError(Error Domain=NSCocoaErrorDomain Code=4097 \"connection to service named com.apple.storekitagent\" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}) Rebooting or re-downloading the App from the Mac App Store, as well as signing out and in again on the Mac App Store does not solve the issue. Strangely enough all of the affected users I'm aware of were initially able to perform In-App purchases via the said app. Without any updates or anything else however suddenly after a restart of the app the above error gets thrown by the system. As I have not found any way to solve this issue yet and the said customers are consequently left without service even though they are paying customers, I am desperate to find help with this issue. Given the simplicity of the AppStore.sync() method for example I can't imagine the solution to lie in code, but I might of course be wrong. Thank you, Bastian
Posted
by betaphi.
Last updated
.
Post not yet marked as solved
4 Replies
492 Views
My StoreKit 2 tests flow looks like this: Buy subscription lvl 1 Buy subscription lvl 2 Buy subscription lvl 1 The problem is that when trying to buy the same subscription again with Sandbox user - the iOS dialogs to confirm Payment are not shown. Product.PurchaseResult in .success but if checking in Settings - the subscription is not changed. What's also interesting: it works if changes directly from System Settings. Any ideas of what is going on would be appreciated.
Posted
by NataliiaL.
Last updated
.
Post not yet marked as solved
4 Replies
342 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 not yet marked as solved
0 Replies
52 Views
We've been receiving the same(originalTransactionId) refund apple store server notification all along. maybe 5times we got. why we've been gotten notification? we are. needed to doing something? Is there anything we need to deal with?
Posted
by afraca.
Last updated
.
Post not yet marked as solved
0 Replies
70 Views
I want to implement In-App Purchase and have some questions about the purchase options. Product description: content is divided into so called journeys. Each journey has several steps, each step contains several content elements (audios, videos, questionnaires) an app user can purchase one journey to use all the content of this journey for a defined period of time (12 month), starting from the day of purchase. the app user can pay an annual fee or a monthly fee (which is slightly higher than the annual fee) a cancellation is not possible, even in the monthly fee model after the period of usage, the customer can decide to purchase the journey again, if not, access to the journey and its content is denied (an auto-renewal is not required) After studying the documentation we tend to use the non-renewable subscription model. What we want to do: offer a non-renewing subscriptions, with a ONE-TIME payment, access starts at the day of purchase and will end after 12 months (ending will be handled by us) offer a non-renewing subscriptions, with a MONTHLY payment, access starts at the day of purchase and will and after 12 month (ending will be handled by us), cannot be canceled by the app user I'm concerned about what I could find so far. Is option 1 the way Apple wants it or should this be done by using consumable/Non-Consumable? How should this be described in the "Display Name" and "Description" of the product? For option 2: Could Auto-Renewable Subscriptions be used here? Since the content of the journeys most likely won't change? Are there any other options or recurring payments beside that? All the others seem to be one-time payments only? Is there a document, which states clearly the rules for approval? In other posts I just saw quotes from mutual documents, which were nowhere linked, differ a lot from what I can find in the app-store-connect help or here
Posted
by Jan_H.
Last updated
.
Post not yet marked as solved
0 Replies
87 Views
If a user has already In-App paid for my app and then deletes it before the subscription runs out and downloads it again, and since my app doesn't keep subscription data in the keychain (which remembers only when the app was downloaded), my app starts the subscribing process. When Apple sees the subscription request, will Apple tell the user that it's already been paid for? I don't see this behavior in the sandbox.
Posted
by vonlost.
Last updated
.
Post not yet marked as solved
0 Replies
168 Views
Problem We are implementing an auto-renewing subscription using StoreKit 2 to allow users to unlock Pro features in our application. Prior to this, our users would purchase a non-renewing subscription of 1-year access to Pro features, and would manually renew each year. We want to offer a 2-week free trial to new customers, but exclude the 2-week free trial from users who have already had access to Pro features within the last 3 months (i.e. loyal customers who have been paying for Pro for several years). Introductory Offer Our current plan is to use an Introductory Offer, but as far as we understand this will apply the free trial to any user whose Apple ID has not yet purchased this auto-renewing subscription within the app (which would be 100% of our users), and we cannot define a user's eligibility for an Introductory Offer on our own. Are we mistaken here?/Will users who have purchased a non-renewing subscription still be eligible for the Introductory Offer on the auto-renewing subscription? Promotional Offer We would like to use a Promotional Offer to apply the free trial at our discretion. However, we noticed the following stated under Promotional Offer in the documentation: "Customers who have not subscribed within the app cannot complete this type of offer" Does this mean that we will need to offer the free trial to 100% of our users? Alternatives Another option we are considering would be creating a separate Subscription product within the same Subscription Group that does not include an Introductory Offer. We would allow new customers to purchase the product with the free trial, and only allow existing customers to purchase the product w/o a free trial. We would like to avoid having to maintain multiple Subscription products for what is ultimately the same "product", and worry that this would be a misuse of Subscription Groups. Interested to hear if anyone else has done that, and whether that is allowed by Apple's app review.
Posted Last updated
.
Post not yet marked as solved
2 Replies
493 Views
I'm following the guidelines for testing StoreKit, I've set up a .storekit file for managing testing, and the prices and descriptions appear as defined when I run the app. I can also Enable "Ask To Buy" - and the ask to buy process works when testing the app. However, I am unable to approve or reject or even see any transactions appear in the Transaction Window. I'm using Xcode 12.0.1 on macOS 10.15.6 and 2 different iPhones on iOS 14.0.1. Please help!?
Posted Last updated
.
Post not yet marked as solved
3 Replies
327 Views
I'm trying to show a review alert using this code: DispatchQueue.main.asyncAfter(deadline: .now()+1, execute: { if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {                 SKStoreReviewController.requestReview(in: scene)             }         }) I'm using MacOS Ventura, with minimum deployment target for macCatalyst as 14.0. This code works on iOS but nothing shows when running for macCatalyst in debug mode.
Posted Last updated
.
Post not yet marked as solved
0 Replies
120 Views
I have used Storekit’s request review method for to ask user for in app review. It was all going well before the last update but now suddenly it stops showing rating popup in app. I tested it in debug mode it works exactly as it should be but the same build was not showing the rating popup in test flight. So I thought it may be problem of TestFlight but even after realising the app it does not show me any rating popup in any of my devices. I tried to uninstall the app and reinstall the app but still it does not show me rating popup in any scenario. Any help will be appreciated.....
Posted Last updated
.
Post not yet marked as solved
0 Replies
123 Views
I have used Storekit's request review method for to ask user for in app review. It was all going well before the last update but now suddenly it stops showing rating popup in app. I tested it in debug mode it works exactly as it should be but the same build was not showing the rating popup in test flight. So I thought it may be problem of TestFlight but even after realising the app it does not show me any rating popup in any of my devices. I tried to uninstall the app and reinstall the app but still it does not show me rating popup in any scenario. Any help will be appreciated.....
Posted Last updated
.
Post not yet marked as solved
3 Replies
590 Views
Hello! I found that on the latest macOS 13 Ventura, my iOS app (iOS-App-On-Mac-With-M1/M2-Chip) is not able to restore IAP purchases or refresh receipt anymore. When using SKReceiptRefreshRequest() to refresh the IAP receipt, I got following error. Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={ NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x1330c1840 { Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={ NSUnderlyingError=0x13338ebf0 { Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “receipt” in the folder “StoreKit”." UserInfo={ NSFilePath=/Users/***/Library/Containers/EC7E888F-3388-418A-92C5-9CBDDC4A1846/Data/StoreKit/receipt, NSUnderlyingError=0x13333a790 { Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" } } } } } } It seems that the receipt cannot be refreshed due to a file permission issue. Also, the SKPaymentQueue.default().restoreCompletedTransactions() function does not get the purchases properly (but also does not report an error). This issue only appears in my iOS app on macOS 13 Ventura.
Posted
by Gong.
Last updated
.
Post not yet marked as solved
0 Replies
213 Views
Is there any way to implement conditional logic for payments in Swift? For example: Say the user has agreed to have 10$ withdrawn from his bank account he connected to his app account if, on a specific day, he has not fulfilled a condition that can be tracked with the app. If he fulfills the condition until 23:59, no money will be withdrawn. If he doesn't, at 00:00 on the next day, the 10$ are automatically withdrawn from his bank account. I don't know of any app that does this and I'm not even sure whether an app like this would be permitted on the app store. I'm not even sure whether that's technically possible. Would be thankful for any helpful input!
Posted
by Ozgunazad.
Last updated
.
Post not yet marked as solved
0 Replies
183 Views
Looking for php script to decript, decode, parse, etc.. a jwt received from iTunes Connect to prepare data for insertion in a sql database on my server. HELP ! I'm a newbie in coding and feel completely lost on my path.. Is someone having an exemple to share with me. Will so much appreciated, let me know Please Best regards Eric
Posted
by epajot.
Last updated
.
Post not yet marked as solved
2 Replies
203 Views
Hey, in our app we show post-purchase flow when a user purchases a subscription and its appearance should depend on the type of purchase: upgrade, downgrade or crossgrade. I found a way how to get this type on the backend side but can not figure out how to get this within the app. I see that Transaction has isUpgraded property but it is always false even if I move from a lower service plan to a higher one. So, I have two questions: Is this actually possible to know on the client when the user upgrades, downgrades or crossgrades? If yes, then how? Thanks
Posted
by proko.
Last updated
.
Post not yet marked as solved
0 Replies
221 Views
I need to display the localized prices on a button in the goods overview VC. I tried over 5 decisions that I found on StackOverflow or from Apple documentation, but both of them did not work. The problem is that the TestFlight displayed totally different than it should be. On an IAP view when the purchase process was started, the price displacing was correct and it shows the local price. Here is my code where I am trying to set the local price: guard let localPrice = IAPManager.shared.products[(self.index)].regularPrice else { return } self.AddPlaylistButton.setTitle("Buy \(self.amountOfImages) images for \(localPrice)", for: .normal) Where products is the fetched array of products by function: public var products = [SKProduct]() public func fetchProducts(){ let request = SKProductsRequest(productIdentifiers: Set(Product.allCases.compactMap({ $0.rawValue }))) request.delegate = self request.start() } I am calling that function in theAppDelegate. Here are the decisions which a have tried: from developer.apple.com extension SKProduct { var regularPrice: String? { let formatter = NumberFormatter() formatter.numberStyle = .currency formatter.locale = self.priceLocale return formatter.string(from: self.price) } } from stackoverflow public func receivedLocalPrice(index: Int, completion: @escaping((String) -> Void)){ var item = SKProduct() for i in products { if i.productIdentifier == productsDictionary[index] { item = i if let formattedPrice = priceStringForProduct(item) { completion(formattedPrice) } } } } func priceStringForProduct(item: SKProduct) -> String? { let numberFormatter = NumberFormatter() let price = item.price let locale = item.priceLocale numberFormatter.numberStyle = .currency numberFormatter.locale = locale return numberFormatter.string(from: price) } With both of them, I saw incorrect prices in TestFlight. To clarify what I mean here are the screenshots: With that example, I show you Apple Tear 1, but I have the same problem with all 10 tears. I need to find the solution to why I see the wrong prices on a view controller, and why I can not get the correct local prices from products. Also, I want to add that my country which is associated with the App Store account is Ukraine, that's why the price should be a bit larger at Tear 1: 1,19$. But also there is the same problem with the German App Store account. All works well only with the USA App Store account.
Posted Last updated
.
Post not yet marked as solved
0 Replies
190 Views
Have a question I couldn’t find any good answers to online, and before I burn a developer relations ticket, I was hoping maybe the community might known an answer. We currently have two apps, one with a subscription, with bundle id com.companyName.app1 and another with a different bundle id, call it .app2 In the future, we are hoping to migrate all users into one app, .app2, as this has way more content and a larger user base than .app1. However, we are not sure what effect this will have on those that have purchased subscriptions in .app1. We know that removing app1 from sale will retain the existing subscriptions and auto-renewals that were in place. But will we be able to restore these subscriptions somehow in app2? My research tends to lead me towards no, due to them having a different bundle id. But we do also keep a record of the user subscription in our cloud, so I’m not sure if we could somehow use that version of the receipt. TIA for any help!
Posted
by Pbush2590.
Last updated
.
Post not yet marked as solved
1 Replies
261 Views
When I try to add a new IAP and enter all the details - it shows the following error and doesn't allow me to "Submit for Review" You can’t submit this in-app purchase because you haven’t provided your privacy policy for all localizations. Add Privacy Policy The problem is my app has no localisations. Default language is English UK. And IAP localisation is only in English UK. So I don't want to and can't add localized privacy policy. I faced this issue earlier too. I had to wait for a few days and it got automatically resolved. Not sure what triggered the resolution but I never added privacy policy in a different localization. Localization of IAP - English UK App Default Language - English UK Privacy Policy - English UK Why is it asking me to locallise privacy policy??
Posted
by abbas2501.
Last updated
.