TechBuzzPro

iOS Receipt Validation Error: Fix It Fast

· 5 min read · Phones & Tablets

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

A receipt validation error on iOS usually means the App Store receipt your app is checking is missing, malformed, or fails the signature check. The quickest fix is to make sure the app was installed from the App Store (not sideloaded or run from Xcode), then delete and reinstall it so a fresh receipt is issued. If you are the developer, verify you are validating against the correct environment (sandbox vs production) and that the receipt data is base64-encoded correctly.

What You'll Need

  • An iPhone or iPad running a current version of iOS.
  • The app installed from the App Store, not from a third-party store or a development build.
  • A stable internet connection.
  • For developers: access to your app's code and, if you use server-side validation, your server logs.

Step-by-Step

  1. Confirm where the app came from. Receipt validation only works reliably for apps distributed through the App Store. If you installed the app from a test build, a configuration profile, or any source other than the App Store, remove it and install the public version from the App Store.
  2. Check your Apple ID sign-in. Open Settings, tap your name at the top, then tap Media & Purchases. Make sure you are signed in with the Apple ID that owns the purchase. If not, sign out and sign back in. Labels can differ slightly by iOS version and region.
  3. Delete and reinstall the app. Touch and hold the app icon, choose Remove App, then Delete App. Reinstall it from the App Store. This forces iOS to request a fresh receipt. Warning: deleting an app removes its local data; back up anything important first.
  4. Restart your device. A simple restart clears temporary glitches that can prevent the receipt from being read. Press and hold the side button and either volume button until the slider appears, then slide to power off.
  5. Update iOS and the app. Go to Settings > General > Software Update and install any available update. Then open the App Store, tap your profile picture, and update the app if an update is listed.
  6. Test with a sandbox account if you are a developer. In Xcode, sign in with a sandbox tester account under Settings > App Store > Sandbox Account (on a test device). Sandbox receipts are validated against the sandbox URL, not the production URL. Using the wrong environment is the most common cause of a 21007 error.
  7. Verify the receipt data on your server. If you validate server-side, confirm you are sending the receipt as a base64-encoded string in the receipt-data field and that your server is posting to the correct endpoint. Check that your server's SSL certificates are current, because expired certificates cause connection failures that look like validation errors.
  8. Handle the 21007 status code correctly. If Apple returns status 21007, the receipt is a sandbox receipt sent to the production endpoint. Resend it to the sandbox endpoint. Conversely, status 21008 means a production receipt was sent to the sandbox endpoint.
  9. Refresh the receipt if it is missing. On the device, use SKReceiptRefreshRequest to request a new receipt when none exists. Do not loop this call; prompt the user to sign in if needed.
  10. Check the app's bundle identifier and version. A receipt is tied to the bundle ID. If you changed the bundle ID or are testing a different target, the receipt will not match. Confirm the bundle ID in your project matches the one in App Store Connect.

Common Mistakes

  • Validating a sandbox receipt against the production URL (or the reverse), which returns status 21007 or 21008.
  • Forgetting to base64-encode the receipt before sending it to your server.
  • Testing on a device where the app was installed via Xcode instead of the App Store, so no App Store receipt exists.
  • Using an expired or self-signed SSL certificate on the validation server.
  • Assuming a missing receipt means a cracked app; sometimes the receipt simply has not been refreshed yet.
  • Hard-coding the validation URL instead of switching between sandbox and production based on the build configuration.

Tips

  • Always validate on your server, not only on the device, so users cannot bypass checks by modifying the app.
  • Log the raw status code from Apple's response; it tells you exactly which environment mismatch occurred.
  • Keep your app's receipt refresh logic separate from purchase logic so a failed refresh does not block a purchase.
  • Test with a sandbox account before submitting to App Review; sandbox behavior differs from production.
  • Store the original transaction identifier so you can re-validate later without asking the user to repurchase.

Troubleshooting

If the error persists after reinstalling, check Apple's System Status page to rule out an App Store outage. If you are a developer and see status 21002, the receipt data is malformed; confirm it is base64-encoded and not truncated. Status 21003 means the receipt could not be authenticated; this often happens with receipts from a different Apple ID or a modified app. Status 21006 means the subscription has expired, which is not a validation failure but a state you must handle. If your server cannot reach Apple's endpoint, test connectivity from the server itself and confirm outbound HTTPS is allowed. On the device, if the app still reports a missing receipt, sign out of the App Store in Settings, restart, sign back in, and reinstall the app. As a last resort, back up your data, erase the device, and restore from backup; this clears corrupted receipt caches but is rarely necessary.

Frequently Asked Questions

What does status 21007 mean?

It means the receipt is from the sandbox environment but was sent to the production validation endpoint. Resend it to the sandbox endpoint.

Why is my receipt missing after installing from the App Store?

The receipt may not have been refreshed yet. Delete and reinstall the app, or use SKReceiptRefreshRequest in your code to request a new one.

Can I validate receipts on the device only?

You can, but it is not secure because the check can be bypassed. Server-side validation is the recommended approach.

Does deleting the app remove the receipt?

Deleting the app removes its local data, including the stored receipt. Reinstalling from the App Store issues a new receipt.

Why do I get status 21002?

The receipt data is malformed. Check that you are sending the receipt as a base64-encoded string and that it is not truncated.

Is a sandbox account required for testing?

Yes, for testing in-app purchases and receipt validation before release. Create a sandbox tester in App Store Connect and sign in on a test device.