You can do it in the following way:
- Open iOS Settings
- Go to “App Store”
- Tap your sandbox account (“SANDBOX ACCOUNT” section at the bottom of the screen)
- Select “Manage”
- “Edit subscription” screen will open and there you’ll have a “Cancel subscription” option for your Sandbox subscription.
With a small delay (it was several minutes for me) you’ll get a server notification with "notification_type": "DID_CHANGE_RENEWAL_STATUS" and "auto_renew_status": "false". This means that the subscription is still valid, but it won’t be automatically renewed when the current subscription period expires.
If you want to test refund (not a regular cancellation), then it’s impossible as far as I know.