How to mock your bank connections for testing purposes

Since Release finAPI v1.17.0 you have the possibility to use the mock service tests/mockBatchUpdate

This is why it will work only on the Sandbox or Alpha environments. Calling it on the Live environment will result in 403 Forbidden.

This service can be used to mock an update of one or several bank connections by letting you simulate finAPI's communication with a bank server. More specifically, you can provide custom balances and transactions for existing accounts and finAPI will import that data into the accounts as if the data had been delivered by a real bank server during a real update. The idea of this service is to allow you to create accounts with specific data in them so that you can test your application in different scenarios.

Please notice the following

  • The Mock service only works for bank connections where you have saved the PIN.
  • Please make sure that the value you pass in the 'accountBalance' field equals the current account balance plus the sum of the new transactions that you pass here, otherwise finAPI will detect a deviation in the balance and fix it with the insertion of a 'Zwischensaldo' transaction.
  • If you try to mock an identical transaction the service returns a 200 OK but finAPI detects it as a duplicate and does not import it again.
  • finAPI will ignore any transactions whose booking date is prior to the booking date of the latest currently existing transactions minus 10 days.

Here is an example:

Let´s say you want to mock your bank connection (bankConnectionId 12345) with a checking account (accountId 54321) where the balance is 100.00 EUR.
If you want to simulate a new transaction with an amount of -10.00 EUR you can e.g. write the body parameters like this:

If it was successful the response contains the response code 200 without any content.

You can now call the service Transactions/getAndSearchAllTransactions and should find that transaction. The transaction also gets a category if it has "useful" keywords.








Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk