App Store Receipts

RSS for tag

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

Posts under App Store Receipts tag

70 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Converting paid app to freemium with IAP
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?
4
0
1.9k
Sep ’23
Where can I get used Offer Codes from?
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
5
0
1.9k
Apr ’24
verifyReceipt in storekit v2
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!
2
2
3.7k
Oct ’23
Seeing ASDErrorDomain Code=603 "Request throttled" for SKReceiptRefreshRequest on iOS 16.1 only
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!
2
3
1.7k
Sep ’23
Managed App vs. Receipt Validation
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.
0
0
867
Jun ’23
Missing local receipt after purchase using StoreKit 2 APIs
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?
3
2
761
Jun ’23
I have a question about App Store Server API - Get Transaction Info.
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.
1
0
1.1k
Jun ’23
How is receipt validation supposed to work for a new Mac version of an old iOS app?
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?
3
0
709
Jun ’23
Do in-app purchase promo codes not work in testflight?
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?
0
0
744
Jun ’23
in-app purchase - App store Server notifications issues in Sandbox
DESCRIPTION OF PROBLEM We have integrated App store server notifications API to receive in-app-purchase transactions. When we are testing in Sandbox mode, we have faced some issue. We tested auto-renewable subscriptions in the application, App store server notifications received two times at the same time with the same transaction ID. In our mobile, We did not disable the "Allow purchases and renewals" option in sandbox account , but in server API it throws renewal failure notification and in few minutes renewal success notification coming 3)We have set 5 minutes interval for transactions in my sandbox account. Some time notifications coming on time, but some time it is delayed. Will this be happen in production also? Any proper way to test this? For failed transactions, transaction ID becomes same as previously succeeded transaction ID. How failed transaction Id is being generated actually? STEPS TO REPRODUCE Implement App store server notification API listener in Node JS Create sandbox account in app store and purchase a Auto renewable subscription from iOS device Expected Result App store server notification should come on time Duplicate transaction ID should not come on auto renewal subscription XCODE version - 14.3
0
0
775
Jun ’23
How to log out from sandbox account on mac os 13.x
Hello everyone I am testing receipt validation for an app to be submitted to the mac app store. After starting the app a login window popped up and I entered my regular apple id before realising I need to enter an apple id associated with a sandbox account. Now I can't get the login window to show again when starting the app, it seems as I am permanently (or temporarily?) logged into the sandbox account on the mac. How can I log out from the sandbox account? Is it even possible? Does the account time out after a while so that I just need to wait?
1
0
717
Jul ’23
Automate In-App purchases using backend APIs
I am interested in using sandbox users for my automation, and I want to bypass the UI and execute the automation using the APIs. I have found the APIs to list users, modify users, and clear purchase history, but I am not sure if there is a way to create and delete users programmatically. https://developer.apple.com/documentation/appstoreconnectapi/sandbox_testers Currently, our app calls Apple to get the payment receipt, and then our internal workflows are triggered based on the response received from Apple. Is there a way to bypass UI and achieve the same thing using the backend APIs for sandbox user accounts? I also need some clarification on how to generate the JWT token for authorization purposes. Do I need to regenerate the JWT token every 30 days? Thank you for your time and consideration.
1
0
614
Jul ’23
does original_transaction_id change after 60 days of expiration
I am trying to calculate apple cut, if users days of paid service is more than a year apple reduces commission to %15. By the docs: If a subscription expires due to a cancellation or billing issue, the days of paid service stop accumulating. If the subscription is renewed within 60 days, the days of paid service resume from the recovery date. So can i assume if original_transaction_id stays the same user not violated 60 days, therefore if i sum all the (expiration_date - purchase_date) with that id, is it a viable result ? Thanks in advance.
0
0
374
Jul ’23
What steps to perform for the upcoming changes to the App Store receipt signing intermediate certificate?
Currently, my app validates App Store receipts on the device, so as per this news, I need to make changes to it, But I am unable to make a decision on where I should start, Can anyone please help me out on this? Do I need to make changes in the device receipt validation? If yes, what steps should I take? OR Should I do the receipt validation from the server side? If yes, then what steps to follow to make a receipt validation on the server? Your suggestions will be highly appreciated.
9
0
1.3k
Jul ’23
Is there a way to see who received a refund on App Store Connect?
Hi, We offer a premium account IAP for our app. We recently noticed on our proceeds section of App Store Connect that a refund for the IAP had been processed but we didn't receive a notification regarding this and from what I can see there is no way to see who applied for it. This is a problem as we need to be able to switch the premium account off for that account. Can someone help with this please?
2
0
517
Jul ’23
Is "StoreKitTestCertificate.cer" needed if my app uses StoreKit 2?
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?
0
1
639
Jul ’23
Get custom codes used in transaction receipt (renewable subscription)
Issue Currently I have multiple subscription offers available for yearly/monthly subscriptions. Each of the subscription offers have multiple different custom codes available. When the customer buys a subscription and the receipt is being handled in the backend, I need to know which of the custom codes was used. What I have tried When i call the https://buy.itunes.apple.com/verifyReceipt I get the values offer_code_ref_name and promotional_offer_id. The offer_code_ref_name is the subscription offer name AND NOT the custom code. I tried to get more info using the https://api.storekit.itunes.apple.com/inApps/v1/subscriptions/{transactionId} request, but it does not give me any info about the custom code used either. I do however see which custom code has been used if I go to Sales and Trends > Sales and Trends Reports and download Subscritpion Reports. There the offer code can be found ref. as "Promotional Offer ID" my question How can I get which custom code was used when purchasing a renewable subscription using transaction id or transaction Receipt?
1
0
455
Aug ’23
Is there any status code indicate that transactionId is from sandbox?
In the old verifyReceipt endpoint doc, there is an important desc As a best practice, always call the production URL https://buy.itunes.apple.com/verifyReceipt first and proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you don’t have to switch between URLs while your app is in testing, in review by App Review, or live in the App Store. So I can know the transactionId is for sandbox if return back 21007. And I am about to access to new App Store Server API, so the same, I wonder how can I recognize the transactionId is from sandbox by status code? The most likely desc is this: If you don’t have environment information, follow these steps: Call the endpoint using the production URL. If the call succeeds, the original transaction identifier belongs to the production environment. If you receive an [errorCode 4040005] with errorMessage as OriginalTransactionIdNotFoundError, (or HTTP response code 404 from the Send Consumption Information endpoint), call the endpoint using the sandbox environment. If the call succeeds, the original transaction identifier belongs to the sandbox environment. If the call fails with the same error code, the original transaction identifier isn’t present in either environment. And I have a try for Get Transaction Info API, but actually get 4040010, Transaction id not found. as return. So I just wanna clear that is there any doc clarify this point that I miss? Looking forward to your response, sincerely!! :)
1
0
1.3k
Sep ’23