Issue with explaining bank transactions

Hi

I am having an issue explaining bank transactions through the API. This is what I am sending

array (
  'bank_transaction_explanations' => 
  array (
    'bank_transaction' => 'https://api.sandbox.freeagent.com/v2/bank_transactions/000000',
    'dated_on' => '2021-05-09',
    'gross_value' => 191.98,
    'paid_invoice' => 'https://api.sandbox.freeagent.com/v2/invoices/000000',
  ),
)

And I get a response of

array (
  'errors' => 
  array (
    'error' => 
    array (
      'message' => 'dated_on is not valid',
    ),
  ),
)

The date format looks correct to me according to the documentation. Is it because I am trying to explain a transaction with todays date? The bank transaction was created manually, also dated today, in a holding bank account.

Any help would be appreciated.

Hi Colin,

Thanks for posting, and I hope I’ll be able to help! You say that the transaction you’re trying to explain has been created manually, was that done through the web app UI? If so, it would have already been fully explained at the time of creation (adding a bank transaction using the button below creates a bank transaction and an explanation at the same time). Screenshot 2021-05-10 at 12.33.39

The only bank transactions that need explanations added are the ones that have been imported through a bank feed or with a bank statement (through the UI or the API).

That said, this still doesn’t quite explain why you’re getting a date-related error, I would normally expect an error message along the lines of "This transaction has already been fully explained" if you tried to add an explanation to a manual transaction. What happens when you try to request the bank transaction in question with GET /v2/bank_transactions/:id, what is the value of the returned dated_on attribute and does the response contain any explanations at all?

Best wishes,

Ewa

Also, could I confirm that the error happens when you make a POST request to /v2/bank_transaction_explanations? I notice that your body includes a bank_transaction_explanations array, rather than a bank_transaction_explanation hash which is required by this endpoint. You can see the required format of the request in our docs here. Could you try adjusting the your request body accordingly and see if that gets you a different response?

Best wishes,

Ewa

The Bank Transaction is being manually created via the API.

This was the issue, I was being thrown by the error message. It was because of the bank_transaction_explanations when it should have been bank_transaction_explanation

Thanks for your help.

1 Like