404 Error Code when Calling Apple Servers - in-app purchase

Hello everyone,

I’m hoping someone might help with auto-renewable subscription validation in Apple’s Sandbox environment. Here’s the situation:

My Setup:

  • I’ve configured three auto-renewable subscriptions in App Store Connect and generated an In-App Purchase key (with the correct Issuer ID and Key ID). (I also tried the App Store Connect API Keys)
  • I’m using Apple’s App Store Server API v2 endpoints (GET /inApps/v2/subscriptions/{originalTransactionId}/latest) to fetch the latest subscription status.
  • I’ve created several Sandbox test users (with fresh email addresses), signed out of old test accounts on my devices, and tested purchasing subscriptions anew.

What Works:

  • I am receiving valid Server Notifications from Apple (e.g. SUBSCRIBED, DID_RENEW) with the correct environment: "Sandbox" field.
  • My JWT generation appears to be correct because I’m no longer receiving 401 errors—only 404. That suggests Apple accepts the key and credentials.
  • My fallback logic attempts production first; if it sees a 404 or 410, it switches over to the Sandbox endpoint. This is exactly what Apple’s documentation recommends.

The Problem:

This happens even though the subscription is active in Sandbox (I see notifications arriving for it). I’ve tried adding a brief waiting period (2 seconds) before calling the Sandbox endpoint, but it consistently returns 404. I’ve also tried multiple retries over a longer timeframe without success. I tested multiple fresh Sandbox test users, ensuring each one was signed in to the device’s App Store. After each new purchase, I still get the same 404.

Additional Checks:

These are definitely auto-renewable subscriptions, not non-renewing or consumable products. I also tried calling GET /inApps/v2/subscriptions/{transactionId}/latest but I still see 404. I tried everything mentioned above in production as I said to no avail: GET https://api.storekit.itunes.apple.com/inApps/v2/subscriptions/{originalTransactionId}/latest

Answered by App Store Commerce Engineer in 823758022

Make sure you're using the URLs noted in the documentation for the endpoint:

https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_

Notably, "/latest" is not part of the URL, and there is no v2 of the Get All Subscription Statuses endpoint; the URL should include "v1".

I also recommend using the App Store Server Library if possible, to simplify your implementation and avoid issues like these:

https://developer.apple.com/documentation/appstoreserverapi/simplifying-your-implementation-by-using-the-app-store-server-library

Accepted Answer

Make sure you're using the URLs noted in the documentation for the endpoint:

https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_

Notably, "/latest" is not part of the URL, and there is no v2 of the Get All Subscription Statuses endpoint; the URL should include "v1".

I also recommend using the App Store Server Library if possible, to simplify your implementation and avoid issues like these:

https://developer.apple.com/documentation/appstoreserverapi/simplifying-your-implementation-by-using-the-app-store-server-library

404 Error Code when Calling Apple Servers - in-app purchase
 
 
Q