Hello, the official code example does not works or contains error.
Very precise repeating the code leading to 0 invoice.
If you read the code carefully, you can see that InvoiceItem is not set anywhere. This seems to be the reason why the new invoice is always 0.
Here is the URL to the documentation, the sample in java.
Please correct the documentation or show how to set the invoice to 1 USD.