Residency Status for Tax on Retirement Income

I will be leaving Japan and my employer will be paying a retirement payout to me. They told me if I leave Japan before termination date I will be taxed as a non resident (20%) flat rate but if I leave after termination date it will be taxed as a resident and will be more favorable. However reading it online I am a bit confused as I saw a few blogs mentioning what matters is the residency status on the payout date not the termination date.

I tried checking with company’s accounting but they are not really helping

Could someone point me to the correct source to confirm this ?

by monster_cookie9