Hi,
We're seeing a recurring issue in Sandbox only with in-app subscriptions (StoreKit 2). Hoping someone has run into this and has a workaround or explanation.
What happens
-
A subscription purchase (e.g. Yearly) is made in Sandbox. For whatever reason, the transaction stays pending in the queue.
-
On the next app launch (or when a different user logs into the app on the same device), the store returns this same pending transaction via getAvailablePurchases() / the purchase queue.
-
Our app sends that transaction to our backend for validation and updates the currently logged-in user in our database. So the same transaction can end up being applied to another user if they log in on the same device after the original purchaser.
-
We call finishTransaction after successful validation, but the pending transaction still reappears in subsequent sessions or for another user on the same device.
So in short: one Sandbox purchase stays "pending" and is replayed every time we start the app or switch accounts, and we can't rely on it being tied to a single user.
Environment
-
Sandbox only (we haven't shipped to production yet).
-
StoreKit 2 / modern App Store Server API (transaction ID validation).
-
We run getAvailablePurchases() on connect and process pending purchases once per session; we then call finishTransaction only after our server has validated and updated the user.
-
Same device, multiple app accounts (different app users, same Sandbox Apple ID or same device).
What we're trying to understand
-
Is it expected in Sandbox that one transaction can be delivered again and again (on each launch or for each user on the device) until something clears it?
-
Is there a recommended way to clear or ignore a specific pending transaction in Sandbox when we've already validated it for a given user (e.g. idempotency key, or a way to "consume" it so it doesn't replay)?
-
Has anyone else hit this "same pending transaction replaying for different users / on every launch" in Sandbox and found a reliable approach (e.g. server-side idempotency, or a StoreKit/Sandbox step we're missing)?
We've added server-side protection (one transaction → one user) so the same purchase isn't credited to multiple accounts, but we'd like to understand if there's a proper way to handle or clear this pending state in Sandbox.
Thanks in advance.