PHP API Create Invoice with Client ID

hi there this codes Sample Works for me
Client is created and invoice s created

$client = new Client('', 'hans', 'dampf' , 'dampfplock');
$invoice = $client->createInvoice();
$invoice->addInvoiceItem('ITEM', 'HotelReservatie ', 150, 1);

BUT How can i create an invoice with an existing client?
can you give me an code example please

with Client id_number-> 99999

thx very much is stuck completely and a merry xmas to all

You need to search using the client id, not their id_number.

$client = Client::find(1);
$invoice = $client->createInvoice();

You can use this API call to lookup the client from their id_number.

curl -X GET<value> -H "X-Ninja-Token: TOKEN"

this works perfect -> thx

last question how to add tax to each single item?

$invoice = $client->createInvoice();
$invoice->addInvoiceItem('Webhosting', 'Das ist der Text für das Webhostung ', 9.90, 12);
$invoice->addInvoiceItem('Newsletter Service', 'Das ist der Text für den Newsletter Service ', 99.00, 1);
$invoice->tax_rate  = 19.000; <-----DOES NOT WORK
$invoice->tax_name  = "MwSt."; <-----DOES NOT WORK

I think this should work:

$invoice->invoice_items[0]->tax_name1 = 
$invoice->invoice_items[0]->tax_rate1 = 

great that works perfect you are my santa

merry xmas