Expense type doesn't get updated

As per title,

I realised that if you make a PUT request sending:

call("PUT", expense.url, { expense: { type:'Payment'} })

the expense won’t be updated.

The official frontend seems to send main_type and it can update the type of expenses - but sending main_type via the API still doesn’t work.

Is it a bug or am I missing something?

Hi there,

The type of an expense (refund/payment) isn’t directly editable on the API, because it’s only a convenience to make the UI more straightforward. You should be using the sign of the gross_value field to set the type of an expense - negative values are Payments and positive values are Refunds.

That is, an expense with:

{
  "gross_value": -100
}

is a Payment expense for 100, and

{
  "gross_value": 100
}

is a Refund expense for 100.

Hope that helps - please let us know if you need more clarification.

Thanks,
Chris Howlett.
FreeAgent

Thank you!

That’s very helpful, I’d recommend updating the relevant documentation: FreeAgent Developer Dashboard