I am trying to test upgrade/downgrade with sandbox user. We have one subscription group in the App Store connect. There are 2 subscription level 1 and 2, both are auto-renewable. When I purchase the level 1 and try to upgrade to level 2 there is no information shown that the user will get refund and the subscription will start immediately. Is it not supported on sandbox? It will be only shown in production? Can it be tested in TestFlight?
Upgrade/Downgrade popup with sandbox user
Yes upgrades and downgrades are fully supported in sandbox, the behavior is determined at the time of buy and uses your product setup in App Store Connect to make that decision.
Note: "Level 1" is the top/highest level, so an upgrade is going from a "level 2" product to a level "1" product. The payment sheet is customer facing so your app must use the storekit transactions to make this determination, easiest way is to just check for the is_upgraded field. If you see that for a transaction, then the next/latest transaction is the current period and would have a different product_id.
See this doc for more info on group setup: https://help.apple.com/app-store-connect/en.lproj/static.html#dev75708c031