Hello all,
I am trying to bulk Create Sales Invoice in Xero.
My Zap utilizes a Catch Hook as the trigger and receives the data in JSON format. (In my test, there are 2 invoices. First invoice has 2 line tems and second invoice has 3 line items).
My JSON:
{
"invoices": [
{
"contactName": "1A Test Company ABN:111 111 1111",
"dueDate":"2025-09-15",
"reference":1020,
"status":"AUTHORISED",
"lineItems": [
{"description":"Item 1","quantity":1,"unitAmount":840,"discountRate":0,"accountCode":202},
{"description":"Item 2","quantity":1,"unitAmount":104,"discountRate":0,"accountCode":202}
]
},
{
"contactName": "3A Test Company ABN:333 333 3333",
"type":"ACCREC",
"dueDate":"2025-09-15",
"reference":1021,
"status":"AUTHORISED",
"lineItems": [
{"description":"Item 1","quantity":2,"unitAmount":840,"discountRate":0,"accountCode":202},
{"description":"item 2","quantity":1,"unitAmount":104,"discountRate":0,"accountCode":202},
{"description":"Item 4","quantity":1,"unitAmount":300,"discountRate":0,"accountCode":203}
]
}
]
}
As can be seen in the screenshot below, Zapier recognized that there are 2 invoices as well as the line items in my JSON payload.

Next I used a Formatter (Line Itemizer) on the line items. However, it is aggregating the line items between the 2 invoices.

When I try to run the Create Sales Invoice action it failed but will work if there is only 1 invoice in my JSON.
I have tried adding Looping before the formatter to separate my invoices but I am not sure how to get it to work properly? Do I add all fields in the loop or just the Contact name which is what separates each invoice.
Ultimately, my problem is not being able to separate the invoices. Can I please ask if I need to structure the JSON differently or what actions should be in my Zap to get this to work.
Thanks!