How to archive and purge transactions programmatically?

SOLVED

Hi all,

I have check on the documentation. but there is no guide to do archive and purge transactions programmatically. What I want to do is to select specific transactions by item code, and archive & purge these transaction, and delete the item code.

thank you