How to import invoice payment information into Sage 500/Mas 500

We have an existing payment engine that processes credit card and checking. I have created the ability to lookup invoices with a balance, "grab" all the details, and offer customer payment through other means. Now I need to bring the payment information back into Sage 500, so the invoice will be closed. Has anyone out there done this before, or know of stored procedures I should focus on?

PS - I am fairly fluent with SQL. I would like to automate this process, so I am trying the SQL way before involving Data Import Manager.

www.targetpayandbenefits.com