To mark an invoice as paid in QuickBooks Online using the PHP SDK, you need to create a Payment object and link it to the invoice. Simply updating the invoice balance won't work because QuickBooks maintains separate entities for invoices and payments.
1-The Payment object will link the payment to the invoice using the LinkedTxn field. 2-Specify the amount that matches the invoice balance. 3-Use the DataService object to save the payment to QuickBooks.
You can check this sample code, it will give you an overview: you may also inspect some external resources; invoice generator