Optional unique metadata.id in Invoice

If invoice.metadata.id already exists in the database, all subsequent invoice creation with the same ID returns
the existing invoice instead of creating a new invoice.