App Store Receipts

RSS for tag

Validate app and in-app purchase receipts with the App Store using App Store Receipts.

App Store Receipts Documentation

Posts under App Store Receipts tag

77 Posts
Sort by:
Post not yet marked as solved
4 Replies
1.8k Views
Hello, I have an existing app which is beeing sold in the app store since 2010. Now I want to convert this app into a free app with optional in-app purchases. A part of the functionality which paid users currently have should then be accessible only by IAP. Therefore, I must identify my existing customers, to not make them pay again for functionality they have paid already. Googling around reveals that this is not easy to do, if it was possible at all. However, I found this post: https://stackoverflow.com/questions/3735635/convert-existing-ios-paid-app-to-freemium-model-with-in-app-purchase Quote: "There is now an Apple-approved way to do this on both iOS and macOS. The originally downloaded version of the app can be obtained from the receipt using the info key Original Purchased Version. You can then decide whether to unlock features if that version predates the switch to IAP." Now I have played around with this a bit, or more precisely: NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; NSData *receipt = [NSData dataWithContentsOfURL:receiptURL]; However, in my tests, receipt will always be nil. The URL also points to some local location with sandbox in the name. Am I doing something wrong in general, or is this just not supposed to work how I thought it would? Note that I have installed my app from the app store on my device, then launched the above code on my device (so I'm NOT testing this in the simulator). I also read about SKReceiptRefreshRequest, however I cant figure out how to use it. So the question is, how would I figure out if a user has already purchased the orignal paid version? My app does not have a server-component, and by checking some NSUserDefaults key would result in charging users which reinstall the app on a new device. So what should I do?
Posted
by
Post not yet marked as solved
1 Replies
875 Views
We are facing iOS appstore receipt validation connection timeout issue. I request the forum if anyone has resolved this issue in the recent past please do share your inputs. Thank you.
Posted
by
Post marked as solved
34 Replies
15k Views
We have an issue with validating in-app purchases which just seemed to start occurring today. When you send a sandbox receipt to the production endpoint (https://buy.itunes.apple.com/verifyReceipt), it returns the status code 21007 with the message. This receipt is from the test environment, but it was sent to the production environment for verification. This is documented here: https://developer.apple.com/documentation/appstorereceipts/status It is then advised to attempt this receipt on the sandbox endpoint (https://sandbox.itunes.apple.com/verifyReceipt) due to the status code returned. We have used this successfully for about a year now. We check the status code and if it is 21007, we then try the sandbox endpoint. As of today, we started seeing that the sandbox endpoint is returning a 21007 status code which does not make sense and threw our API into a recursive loop since it kept seeing that status and kept trying the sandbox endpoint. This status code is clearly wrong as it was not 'sent to the production environment' in these cases and this status code has never been returned in the past from the sandbox endpoint. Is this a bug introduced by Apple as of today or has something changed that I have not seen the documentation for?
Posted
by
Post not yet marked as solved
5 Replies
1.8k Views
I would like to programmatically keep track of offer codes that have been used. I just configured a Test Offer Code (Reference name), which contains 500 codes (Offer Codes) to buy a 1-month subscription for 0,49€. I was able to redeem the code and everything works, but I was expecting to receive the used code. Instead I received the Reference name in the payload from the App Store Server Notification in the field offer_code_ref_name="Test Offer Code". (expected was sth like offer_code_ref_name="JFFDS61SBJDBJ5BXJS4BX") I would be able to identify the Reference name by the code, if it was provided, because I have the following table in my app's backend: reference_name | code | url | expires_at | used | reserved Test Offer Code | xadz | zzz | 31-07-2022 | t | f Test Offer Code | asdf | *** | 31-07-2022 | f | f The used code doesn't seem to be included in the latest receipt. How can I obtain it? Can I somehow call App Store Connect API? Thanks
Posted
by
Post not yet marked as solved
2 Replies
3.3k Views
Hi, Currently we are using store kit api and we get the receipt which then backend validate from apple using /verifyReceipt. Now we are planning to move to store kit v2 api. But in this case, we are getting signedPayload instead of receipt. Now this signedPayload cannot be used in the /verifyReceipt. So what is the other way to validate the signedToken from apple and get the data that we get from the /verifyReceipt response. Thanks for the help!
Posted
by
Post not yet marked as solved
1 Replies
1.6k Views
I am using local receipt validation and the SKReceiptRefreshRequest API to restore purchases. When my iOS 16.1 users tap "restore purchase", the call fails. Notably, it does not ask the users to log into their iTunes account (it normally does) and my app logs the following error: <SKReceiptRefreshRequest: 0x281b0ad20>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=603 "Request throttled" UserInfo={NSLocalizedFailureReason=Unified receipt is valid and current, NSLocalizedDescription=Request throttled, AMSServerErrorCode=0} These errors started showing up after the release of 16.1 and appear to be limited to that specific version of iOS. The relevant code has not changed in years and I have iOS 15 and iOS 16.0 users who are currently able to restore purchases without issue. Also, I am not able to reproduce the issue in the sandbox but I am able to do so in production. I'm a bit at a loss. Why would my request be "throttled" and, further, why only on iOS 16.1 and only in production? Any thoughts on what could be happening here? Any help is much appreciated. Thank you!
Posted
by
Post not yet marked as solved
4 Replies
1.2k Views
Hi, Apple just rejected my app because IAP is not working. It was working yesterday of course but today I am receiving this error: ["msg": "Purchase failed. Error Domain=SKErrorDomain Code=0 \"An unknown error occurred\" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x2810320a0 {Error Domain=ASDServerErrorDomain Code=3004 \"We are temporarily unable to process your request.\" UserInfo={NSLocalizedDescription=We are temporarily unable to process your request.}}}", "error": Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x2810320a0 {Error Domain=ASDServerErrorDomain Code=3004 "We are temporarily unable to process your request." UserInfo={NSLocalizedDescription=We are temporarily unable to process your request.}}}] I know that yesterday App Store - Receipt Verification - was in outage. I am wondering if this is same problem? Does it work for you?
Posted
by
Post not yet marked as solved
0 Replies
539 Views
I would like to determine which app version the user first downloaded. For that, I'm using StoreKit and the originalAppVersion property of AppTransaction: let verificationResult = try await AppTransaction.shared switch verificationResult { case .verified(let appTransaction): return "\(appTransaction.originalAppVersion) (\(appTransaction.environment.rawValue))" case .unverified(let appTransaction, let verificationError): // The app transaction didn't pass StoreKit's verification. The code runs fine, but always returns "1.0" for the app version and "Sandbox" for the environment. I tried debug/release builds and even pushed a build to TestFlight. Is the only way to test this to push a new App Store version that should go live?
Posted
by
Post not yet marked as solved
3 Replies
670 Views
Dear All, My iOS app used to work OK on macOS, but since a macOS update in-app purchases have stopped working. It seems that the storekitagent process is no longer able to save the receipt to the filesystem. Here is what I see in the system log after I do a "refresh receipt": default 22:03:47.822657+0100 storekitagent [58C16E76_SK1] Writing receipt (83905 bytes) to file:///Users/phil/Library/Containers/0407ACA7-9EE2-4E32-AA3E-101A1B38EE70/Data/StoreKit/sandboxReceipt error 22:03:47.823539+0100 kernel Sandbox: storekitagent(1382) deny(1) file-write-unlink /Users/phil/Library/Containers/0407ACA7-9EE2-4E32-AA3E-101A1B38EE70/Data/StoreKit/sandboxReceipt error 22:03:47.824306+0100 storekitagent [58C16E76_SK1] Error writing receipt (83905 bytes) to file:///Users/phil/Library/Containers/0407ACA7-9EE2-4E32-AA3E-101A1B38EE70/Data/StoreKit/sandboxReceipt: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “sandboxReceipt” in the folder “StoreKit”." UserInfo={NSFilePath=/Users/phil/Library/Containers/0407ACA7-9EE2-4E32-AA3E-101A1B38EE70/Data/StoreKit/sandboxReceipt, NSUnderlyingError=0x145c19f80 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} Note that is a sandboxReceipt on my development system, but I have a report from a user who seems to be suffering the same problem with the app store version of the app. Is anyone else seeing this? Is there a "quick hack" I can do to grant the storekitagent process permission to write to that folder?
Posted
by
Post not yet marked as solved
1 Replies
605 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
1 Replies
513 Views
Hello all, we have in-app purchases in our application. Our server is used to verify all transactions. We get transaction_id from verifyReceipts API along with other data. In the report that we get from Apple, there is no transaction_id or any common field that can uniquely identify a payment. Can we add transaction_id into reports somehow?
Post not yet marked as solved
4 Replies
893 Views
Since "2023-06-14T15:00:00Z" UTC, Too many ETIMEDOUT (https://buy.itunes.apple.com/verifyReceipt) errors have occurred. Is there any issue on buy.itunes.apple.com server? IAP server status seems okay. https://developer.apple.com/system-status/
Posted
by
Post not yet marked as solved
0 Replies
822 Views
Hello! If you see this post on stackoverflow, it's because I posted in both places. I have an app that I'm doing receipt validation via the validateReceipt endpoint (for iOS15) and the new StoreKit2 AppTransaction for iOS16. All is well until... A user reported that the app keeps telling him that there is no app receipt to validate and wants him to sign in and get a new receipt. Trouble is, his iPad is under device management from Mosyle and he doesn't have the account ID or password to sign in with. Well duh, of course not, that's handled by IT. My understanding is that the receipt is tied to the user account and the device that the app is on, so if the app is being distributed from a server then the receipt won't match the device, or possibly isn't even part of the distribution. I'm unclear on this, as all I'm getting is an alert about the receipt. I'm adding more code to detect and report on what might be happening inside the app, but in the meanwhile I have to figure out what to do to get rid of the warning prompt. My questions, after having read volumes of unhelpful information about MDM's, are simple. Is there a way to detect inside the app if the app was installed via an MDM? Can I tell from inside the app if the device is registered in an MDM? And how can I tell that the app is authorized to run on the device if the receipt validation methods aren't, well, valid? I have tried multiple combinations of search terms yet nowhere can I find out how to detect a valid MDM configuration and thus not look at the receipt. It seems the answer is either that developers aren't checking their receipt or that the solution is so blazingly simple that I'm just not seeing it.
Posted
by
Post not yet marked as solved
0 Replies
662 Views
After completing a purchase using the StoreKit 2 APIs and receiving a successful and verified Product.PurchaseResult, the local receipt is still empty. Ideally I would not need this anymore, but our server-side implementation currently requires the encoded receipt data so for my current use-case I need to access it still. My purchase flow looks like so: let purchaseResult = try await product.purchase(options: purchaseOptions) switch purchaseResult { case .success(let verification): let transaction = try checkVerified(verification) ... guard let receiptPath = Bundle.main.appStoreReceiptURL?.path else { throw Error.missingReceipt } let receiptData = NSData(contentsOfFile: receiptPath) // Receipt data is nil here let receiptString = receiptData?.base64EncodedString(options: .endLineWithLineFeed) ?? "" ... // Handle server logic ... await transaction.finish() case ... ... } My understanding was receipt data should still be generated when using StoreKit 2 APIs - is there a way to guarantee it is populated after successfully completing a purchase and during transaction handling?
Posted
by
Post not yet marked as solved
1 Replies
993 Views
As verifyReceipt has been deprecated this time, I am trying to verify the receipt using Get Transaction History Endpoint. Apparently, Apple's official document says it will return the value for a single transaction if you request it to the endpoint, but it keeps returning the value by combining all the information about different Transaction IDs. If there are developers who know about this, please answer. Also, please let me know if anyone knows how to verify the receipt using this endpoint.
Posted
by
Post not yet marked as solved
3 Replies
657 Views
Background: I've had an app in the iOS app store for many years. Quite recently I published a Mac version of the app. The Mac version uses the same bundle id and the app is setup in App Store Connect to be the same app. It's my understanding that with this setup, if a user purchases the iOS version, they don't need to pay for the macOS version (or vice versa). The iOS app started out as a paid app and was later transitioned to a free app with in-app purchases. The new macOS version also supports the same IAPs. If it makes a difference, the macOS version is built from the iOS code base using Mac Catalyst. The app uses old StoreKit1 on-device receipt validation. Issue: I have a longtime user of the iOS app that has recently installed the macOS version. Their attempt to restore purchases in the macOS version is not resulting in anything being restored. The user originally purchased the old iOS version before it had any in-app purchases. I log diagnostic info in the app and the user sent me those logs. One of the things I show in the log is information from the receipt. The on-device receipt validation my app does is indicating it is a valid receipt. The problem is that the receipt states the original version of the app corresponds to the new macOS build. i would expect the receipt to show the version originally purchased years ago on iOS. Question: What is supposed to happen in a case like this? When the macOS version of the app requests (and gets) an updated receipt, is the receipt supposed to show the original version as the first macOS version of the app or is it supposed to show the first downloaded version, regardless of OS? What is the correct logic for restoring purchases if the macOS receipt has no indication of the user ever having used the iOS version for years?
Posted
by
Post not yet marked as solved
0 Replies
714 Views
In Testflight app on iphone, on entering promo code for in-app purchase, we are getting a success message from the app store on redeeming but the purchase success event in the react native code that works for in-app purchases is not being triggered. I found some discussions from a few years back that mentioned that promo codes only work in production environment. So do promo codes still only work in production environment or is there a way to test promo codes in testflight?
Posted
by