purchases-ios
purchases-ios copied to clipboard
Testing macOS IAP in sandbox
- [✅ ] 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 In sandbox, when running a macOS app with .storekit configuration, even if it's launched with Xcode or Finder, the StoreKit products are visible. But when one of them is purchased, or when restoring purchase, the error is: The receipt is missing.
Otherwise, in the StoreKit transaction debugger, Xcode says "⚠️ The transaction has not been finished by calling [SKPaymentQueue finishTransaction:]", on each "purchased" product
In other terms, RevenueCat in sandbox IAP environment can't tell which entitlement is active.
-
Environment
- Platform: macOS 13
- SDK version: 4.20.0
- StoreKit 2 (disabled with
useStoreKit2IfEnabled(false)
) (Y/N): No - OS version: 13.5 Beta (22G5027e)
- Xcode version: 14.3 (14E222b)
- Affects all users, 100%
-
Debug logs that reproduce the issue
On .purchase call:
[Purchases] - INFO: 💰 Purchasing Product 'myProduct' from package in Offering 'default' [Purchases] - DEBUG: ℹ️ Adding payment for product 'myProduct'. 2 transactions already in the queue. [Purchases] - DEBUG: ℹ️ StoreKit1Wrapper (0x000060000303fc60) updatedTransaction: myProduct 0 1 [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple. [Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest started [Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest finished [Purchases] - WARN: 🍎‼️ Unable to load receipt, ensure you are logged in to a valid Apple account. [Purchases] - ERROR: 🍎‼️ The receipt is missing. [Purchases] - ERROR: 💰 Product purchase for 'myProduct' failed with error: Error Domain=RevenueCat.ErrorCode Code=9 "The receipt is missing." UserInfo={readable_error_code=MISSING_RECEIPT_FILE, source_function=handlePurchasedTransaction(_:storefront:restored:), NSLocalizedDescription=The receipt is missing., source_file=RevenueCat/PurchasesOrchestrator.swift:744}
On .restorePurchases call:
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: xxxx-A0BD-49FD-BF4A-xxxx [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple. [Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest started [Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest finished [Purchases] - WARN: 🍎‼️ Unable to load receipt, ensure you are logged in to a valid Apple account. Error: loadedEmptyReceipt [Purchases] - WARN: 🍎‼️ App running in sandbox without a receipt file. Restoring transactions won't work until a purchase is made to generate a receipt. This should not happen in production unless user is logged out of Apple account. [Purchases] - ERROR: 🍎‼️ The receipt is missing.
- Steps to reproduce, with a description of expected vs. actual behavior
Add needed products on RevenueCat.com and follow the guides to configure the SDK in a macOS app.
Configure the .storekit file and link it into the app's scheme in Xcode.
Login with a valid sandbox user in App Store.
Build app to call .purchase(package: Package) async throws
Build app to call .restorePurchases(completion: ((CustomerInfo?, PublicError?) -> Void)?)
.
Both calls fail with error The receipt is missing
.
Open Xcode's StoreKit Transactions.
Observe that transactions are not finished (see screenshot).
It's expected to successfully purchase a product, generate a receipt, and to return the active entitlement through the CustomerInfo.
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)