purchases-ios: Issue with receipt. Receipt is not valid
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.
- Environment
- Platform: iOS & MacOS
- SDK version: 4.16.0
- StoreKit 2 (disabled with
useStoreKit2IfEnabled(false)) (Y/N): default - OS version: MacOS 12.x, 13.x, iOS 15.x, 16.x
- Xcode version: 14.1.0
- How widespread is the issue. Percentage of devices affected.
- Debug logs that reproduce the issue
- Steps to reproduce, with a description of expected vs. actual behavior
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Additional context The Apple stuff experimented this error each time that starts to reviewing.
This error was experimented also on: https://github.com/RevenueCat/purchases-ios/issues/2074#issuecomment-1330389918,
2022-11-29 10:30:55.031363+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: app_product 2000000139898222 2000000042575785 1
2022-11-29 10:30:55.032634+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
2022-11-29 10:30:55.032724+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: app_product 2000000139941350 2000000042575785 1
2022-11-29 10:30:55.033742+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
2022-11-29 10:30:55.033817+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: app_product 2000000139998667 2000000042575785 1
2022-11-29 10:30:55.034896+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
2022-11-29 10:30:55.035001+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: app_product 2000000140025065 2000000042575785 1
2022-11-29 10:30:55.036151+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
2022-11-29 10:30:55.036248+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: app_product 2000000140060987 2000000042575785 1
2022-11-29 10:30:55.037464+0100 app[15527:1106073] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
--------
DEBUG: ℹ️ PaymentTransactionObserver (0x00000002815b2cc0) removedTransaction: app_product 2000000204486462 2000000042575785 1
2022-11-29 17:58:42.671777+0100 app[20021:1250441] [Purchases] - DEBUG: ℹ️ PaymentTransactionObserver (0x00000002815b2cc0) removedTransaction: app_product 2000000204486461 2000000042575785 1
2022-11-29 17:58:42.677649+0100 app[20021:1250441] [Purchases] - DEBUG: ℹ️ PaymentTransactionObserver (0x00000002815b2cc0) removedTransaction: mi app_product 2000000204486463 2000000042575785 1
2022-11-29 17:58:42.679432+0100 app[20021:1250441] [Purchases] - DEBUG: ℹ️ PaymentTransactionObserver (0x00000002815b2cc0) removedTransaction: app_product 2000000204486449 2000000042575785 1
2022-11-29 17:58:43.297245+0100 app[20021:1250441] [Purchases] - DEBUG: ℹ️ PaymentTransactionObserver (0x00000002815b2cc0) removedTransaction: app_product 2000000204486464 2000000042575785 1
ERROR: 😿‼️ The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.
This error is happening on MacOs and iOS on TestFlight:
ERROR: 😿‼️ The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.
And the reviewer rejects the binary each time that starts to make a purchase and the purchase cannot be done because of it.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 60 (22 by maintainers)
The receipt verification service is down https://developer.apple.com/system-status/
Looks like it’s related to this news: https://developer.apple.com/news/?id=ytb7qj0x
It would have been good if this was more widely reported to users - really disappointed that I have to check a GitHub issue to see this information in regards to not using SK2
@msavaria we recently fixed a sort of related issue in the backend, so I’m not surprised that you can’t reproduce anymore 😃
We’re also doing more work to ensure that “receipt is not valid” errors provide more context, since there’s actually many reasons why that error can occur (many of which are misconfigurations).
I’ll close this issue for now, but please let us know if you encounter this again and we’ll be happy to help.
I can reproduce this via the following steps.
receive the error: The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.
Interestingly enough, I can successfully purchase non-purchased subscriptions, which is why I think step 2** is the key to this bug. I can also repurchase subscriptions that expire naturally (sandbox does this after a dayish for most durations)
** update, the subscription started working again after the “natural” expiration period lapses. I am implying that the natural expiration is some default limit on the subscriptions that sandbox accounts impose. So I found this error to be apparent during the period after cancelling and next expiration cycle and the “natural” sandbox expiration time.
@tawhidkuet04 thanks for the update! We’re still seeing some apps having issues so it looks like it’ll take a bit to propagate to everyone, but it’s good to hear it’s working for you.
@piersebdon you’re right. It’s been a bit of a struggle on our side since SK2 does handle many things better, but it seems more prone to this sort of unpredictable behavior in practice.
In production, both Sk1 and Sk2 work reasonably well (better than in sandbox at least), but settling on a recommendation has been a bit difficult to be honest. We’re working on improving our own data w/regards to real life performance of both, which will allow us to provide a more informed recommendation, and when we have that we’ll communicate it out.
I apologize for the inconvenience.
i think i have same issue how can i solve it ?
@NachoSoto So… I’ve been trying to get a repro for the past two days but now it works every time 🥲 Nothing really changed on my end except enabling verbose logs.
I’ll follow up when/if I get the error again.
Yes NachoSoto, Sandbox env and on device. If it makes a difference, I got the error on a couple of different builds, Testflight build as well as a deploy to device from Xcode.
Your second point is also correct: I let the subscription expire by opting out of auto-renew (it is done automatically after 12 renewals). Here’s a screenshot from my RC dashboard if that helps:
Subscription expires every hour and automatically renews 12 times until automatically opting out. At that point, when I try to manually resubscribe, I get the
Receipt is not validerror.Of course, I’ll work on getting you those verbose logs.
Any ETA on when we can expect a fix? I have the issue as well and it’s obviously a show stopper for my release.
Here’s the error logs that I got:
And here’s what I noticed:
purchases-iosto4.24.0and disabled theusesStoreKit2IfAvailableflag, as recommended. Anecdotal, but before I was on version4.17.8withusesStoreKit2IfAvailableset totrueand I only had the issue once. After upgrading the package, it now basically happens every time I try to resubscribe.I’ve been getting similar errors from the Flutter SDK on iOS while testing purchases. I’m on RevenueCat Flutter SDK 4.11.1.
Purchase Error: PlatformException(8, The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., {code: 8, underlyingErrorMessage: The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., userCancelled: false, message: The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., readableErrorCode: INVALID_RECEIPT, readable_error_code: INVALID_RECEIPTI’ve run into this issue in the past as well. A few things that fixed it for me:
usesStoreKit2IfAvailable: false, already outlined above by several people.app/.ipabinary) is on the host OS’ disk. If this folder is on any other disk, Sandboxing prevents the OS from writing the receipt to the app’s contents folder.Using StoreKit2 style web hooks under AppStoreConnect has no effect on any of this. RC continues to correctly parse the webhook and process it.
In my case, my app was being built for iOS-Universal and Mac Catalyst.
I hope this helps someone.