The condition to be determined to be draft orders when we create new invoices

First,i created a new customer by using customer api ,
and created a new order which has the customer_id by using orders api.
Next , i created a new invoice which has the order_id by using invoices api.
then, when i look at the dashboard , the invoice had a draft order.

i expected to create an invice which connected the customer_id,order_id,and not had draft order.

please tell me the condition to be determined to be draft orders when we create new invoices!!

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Invoices API
Create Orders
Square Developer

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

When you create an invoice using the Invoices API, it is initially in a ‘DRAFT’ state. This means the invoice has been created but not yet published. Square takes no action on an invoice until it’s published. You can use the ‘PublishInvoice’ endpoint to publish the invoice. Once published, the status of the invoice changes from ‘DRAFT’ to ‘UNPAID’ or ‘SCHEDULED’ depending on the invoice settings.

Please note that the customer_id and order_id fields in the invoice are used to associate the invoice with a specific customer and order. However, these associations do not automatically change the state of the invoice from ‘DRAFT’ to ‘UNPAID’ or ‘SCHEDULED’. You need to explicitly publish the invoice using the ‘PublishInvoice’ endpoint.

This answer was reviewed by @Bryan-Square.