Creating an Invoice for nonregistered customers

I was reading over the invoices api documentation and from what I could tell the person I’m creating the invoice for needs to have a customerId associated to them to do this.

the language here https://developer.squareup.com/docs/invoices-api/overview
seemed to suggest that was the case

The Invoices API requires an order ID and a customer ID to create and publish an invoice. This enables built-in integration with the Orders API and Customers API. For example, the Invoices API ensures that the invoice payment requests are equal to the total order amount and retrieves the customer's email address from the customer profile.

I was wondering if I could just send it to an email / phone without needing a customer ID In the event the customer doesn’t already have a square account?

A secondary question I had was for the invoices is there a field to set that lets it automatically cancel/delete the invoice after a set amount of time such as 15 minutes? That way I can trigger a webhook for the invoice to update my API.

Thanks for your help,
Jarrod S.

Hi @JSwartz welcome to the forums!

To be clear, having a customer profile is not the same as having a Square account. If you have their email/phone number, you can create a customer profile for them using the CreateCustomer endpoint (this does not create a Square account, this is a customer solely on your merchant account).

No, unfortunately no way to automatically cancel the invoice, you would need to manually call CancelInvoice endpoint to do that.