https://www.irs.gov/publications/p537#en_US_2023_publink1000221601
1. you figure out your Gross profit percentage. (gross profit) / contract price = x%
2. for the principal you received for the year, x% * principal is subject to capital gain tax.
3. the interest you received for the year is taxed under ordinary income.
Next year, repeat 2 and 3.