Payment creation

Hello all, I have a mobile application that is currently integrated with Dynamics AX.

I have just begun trying to integrate it to NAV 4.0 sp3 and have zero experience functionally or technically with NAV. I have been able to figure out how to create sales orders and customers utilizing XMLPorts but am trying to figure out how to create a payment in NAV.

I have 2 scenarios:

  1. An order is placed on the mobile that we also capture payment for. When this hits NAV, I create the sales order, invoice and post it. But, where do I create the payment?

  2. A customer can submit a generic payment through the mobile. For example, John from ABC company gives me $100 toward his account. On the mobile, I create a new payment for ABC for $100. Where does this go in NAV? Can I apply a payment in NAV without an invoice as a reference?

Any guidance/examples into what tables and codeunits do these kinds of actions within NAV would be greatly appreciated.