If you’re using a form to write the new row to the purchases sheet, you can pass the RowID automatically by using Screen Columns.
The UI is outdated in the video, but the process is identical: