Start out using Security Assist to create the Login registration functionality.
Use eCart to handle adding the license to the cart and processing the transaction.
eCart's Store order Summary and Store order details can be used to store the transaction information in the database.
the Order table should have a column to relate the order to the users table.
there is a tutorial titled "Applying Register/Login to your checkout" that may help.