changed addInvoicePayment function to localAPI