Retrieving 'invoice date' via Invoices API

We are trying to report on all of the invoices for a given ‘invoice date’ (the 'invoice date’that was sent to the customer, and that is displayed when you view an invoice inside of the Square web interface).

When we retrieve the invoice objects via the API it does not have the ‘invoice date’ listed… it has only the due_date, created_at, updated_at and the sale_or_service_date. None of these dates match the one that is displayed for the invoice inside of the square interface. What am I missing here? How do I access the ‘invoice date’ for a given invoice via the square api?

: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:

https://developer.squareup.com/docs/app-marketplace/requirements/invoices-api

Additional Documentation

Working with Dates
Pay or Refund Invoices
Retrieve, List, or Search Invoices

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.

The ‘invoice date’ that you see in the Square web interface corresponds to the ‘scheduled_at’ field in the Invoices API. This field represents the date and time when the invoice is scheduled to be published. If the ‘scheduled_at’ field is not specified when creating the invoice, it defaults to the current date and time. Therefore, to access the ‘invoice date’ for a given invoice via the Square API, you should refer to the ‘scheduled_at’ field.

This answer was reviewed by @Bryan-Square.

I do not see a scheduled_at on the invoice object.

Below is the sample invoice data from your API documentation, these are the only fields we are see as well:

{
“invoice”: {
“id”: “inv:0-ChD_YNSHr4E6FJDariEoAexample”,
“version”: 1,
“location_id”: “S8GWD5example”,
“order_id”: “IVbTFOMBAGigR3fQYXlRexample”,
“payment_requests”: [
{
“uid”: “b165ffb1-e406-4ad7-bff3-6c216example”,
“request_type”: “BALANCE”,
“due_date”: “2022-09-29”,
“tipping_enabled”: true,
“computed_amount_money”: {
“amount”: 5000,
“currency”: “USD”
},
“total_completed_amount_money”: {
“amount”: 0,
“currency”: “USD”
},
“reminders”: [
{
“uid”: “65338625-5512-4bc6-9c8b-636aBexample”,
“relative_scheduled_days”: -1,
“message”: “Your payment is due tomorrow.”,
“status”: “PENDING”
},
{
“uid”: “98d9c2b6-35a0-4392-ab5c-bb791example”,
“relative_scheduled_days”: 3,
“message”: “Your payment is overdue.”,
“status”: “PENDING”
}
],
“automatic_payment_source”: “NONE”
}
],
“primary_recipient”: {
“customer_id”: “PGN6M13PEMX0S3D81NCexample”,
“given_name”: “Jane”,
“family_name”: “Doe”,
“email_address”: “[email protected]”,
“phone_number”: “1-206-555-1234”
},
“invoice_number”: “99846825”,
“title”: “My Invoice Title”,
“public_url”: “Square”,
“next_payment_amount_money”: {
“amount”: 5000,
“currency”: “USD”
},
“status”: “UNPAID”,
“timezone”: “America/Los_Angeles”,
“created_at”: “2022-07-25T14:26:54Z”,
“updated_at”: “2022-07-25T14:29:02Z”,
“accepted_payment_methods”: {
“card”: true,
“square_gift_card”: true,
“bank_account”: false,
“buy_now_pay_later”: false,
“cash_app_pay”: false
},
“delivery_method”: “EMAIL”,
“sale_or_service_date”: “2022-08-24”,
“store_payment_method_enabled”: false
}
}

When you created the invoice was the scheduled_at set? :slightly_smiling_face:

I don’t know. Our finance department creates the invoices.

When our finance group creates invoices, they are sent out to customers and an ‘invoice date’ is at the top of them.

When I produce a list of invoices from the Square web invoice report interface filtered for a given month, it gives me a list of all of the invoices for that month using that same ‘invoice date’.

We need to produce a report in our analytics system which tallies this same list of invoices using that same date that the square website uses, but when we retrieve the list of invoices from the Square API, that date is nowhere to be found. I am wondering how I can retrieve that same list that the square reports are reporting on.

Okay, so the invoice was not created by the Invoices API but instead the Dashboard.

Do you have an example of this. Like a report from the Dashboard that has an invoice that wasn’t in the API response? :slightly_smiling_face:

Yes, our finance department creates the invoices using the dashboard, and we see the invoices if we get all of the invoices from the invoice API, but the problem is that the date that is on the invoice does not match any of the dates being returned from the invoice API.

We need to be able to report to our accounting department daily totals for all of the invoices based on the ‘invoice date’ as it displays in the dashboard, but we have no way to do that as we do not get the same ‘invoice date’ in any of the data being returned from the api. If we do our reports using any of the other dates, then the totals for the day do not match the actual total of the invoices sent out that date (which is what the ‘invoice date’ indicates). I can get you an invoice id sample of one that does not match from our system if that helps.

If you could get the example I’ll be able to look into this more. Also are you adjusting your query to account for UTC time? That’s the time that all our timestamps are returned in. :slightly_smiling_face:

Here is one invoice from the web portal with the invoice date circled:

And here is the associated data for the same invoice we get from the api, note the above data is not present: