Skip to content

I get "Invoice Type must be specified" when creating an invoice even when I specify "Type": "ACCREC" #432

@iwgreenhouseemail

Description

@iwgreenhouseemail

SDK you're using (please complete the following information):

Describe the bug
I'm unable to create a new invoice when I pass what I believe to be valid JSON to the Invoices API. I receive the message "Invoice Type must be specified" even though I pass a valid invoice type of "ACCREC". The full JSON I'm sending is:

{
  "Type": "ACCREC",
  "Contact": {
    "ContactID": "4a741842-6ffa-41af-848d-b988d8939a0a"
  },
  "DueDate": "\/Date(1769040000000+0000)\/",
  "LineItems": [
    {
      "Description": "Website Other",
      "Quantity": "1",
      "UnitAmount": "195.00",
      "AccountCode": "211"
    }
  ],
  "Status": "AUTHORISED"
}

And I'm receiving this in return:

{
  "Id": "48aed37d-3f5f-4e79-8eec-c1aa3adc6802",
  "Status": "OK",
  "ProviderName": "CMSinvoicesCustom2",
  "DateTimeUTC": "/Date(1767868604980)/",
  "Invoices": [
    {
      "InvoiceID": "00000000-0000-0000-0000-000000000000",
      "Payments": [],
      "CreditNotes": [],
      "Prepayments": [],
      "Overpayments": [],
      "IsDiscounted": false,
      "InvoiceAddresses": [],
      "HasErrors": true,
      "InvoicePaymentServices": [],
      "Status": "DRAFT",
      "LineItems": [],
      "StatusAttributeString": "ERROR",
      "ValidationErrors": [
        {
          "Message": "Invoice Type must be specified"
        }
      ]
    }
  ]
}

To Reproduce
Steps to reproduce the behavior:

  1. Use the above JSON and send a Rest POST request to https://api.xero.com/api.xro/2.0/Invoices?summarizeErrors=false
  2. Check the response.Content

Expected behavior
I'd expect an invoice to be created for that customer

Screenshots
Here's my JSON (on the left) compared with an example of the minimum JSON necessary to create an in voice (on the right) that I obtained from the Xero API website which leads me to believe that I'm sending the correct payload to the API
Image

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions