This is actually a pretty well-known sandbox quirk. Prorated refunds and entitlement transitions for subscription upgrades don't always work correctly in sandbox, especially with the accelerated renewal timescales. In production, when a user upgrades, the original plan's entitlement should end right away and the new plan kicks in immediately, with the prorated refund handled behind the scenes. I'd suggest checking the expiresDate in the JWSTransactionDecodedPayload from the UPGRADE notification instead of relying on the current entitlement endpoint in sandbox, and try validating the full flow via TestFlight or production to confirm everything behaves as expected.
Topic:
Community
SubTopic:
Apple Developers
Tags: