n8n invoice API retries without duplicate records
Jasper Addyman
Published
An original Sheetstead Studio example of what happens when a destination has saved an invoice but the caller receives a timeout. Retrying a request should recover the result without creating another invoice. All data is fictional.
What I built
A nine-node n8n workflow validates amounts, uses stable invoice keys and sends requests to a Python fixture API. The API stores each key and amount in SQLite. It returns the stored result for an exact replay and flags a conflict when the amount changes. The workflow caps retries at three attempts and records rejected or exhausted cases separately.
What I checked
I ran all eight cases twice in n8n 2.47.3, restarting the fixture API between runs. Independent database checks found the same three records and £454.00 in fictional invoice amounts after both runs. The tests cover duplicate keys, changed amounts, HTTP 429 and 503, a gateway timeout after a committed write, permanent rejection, exhausted retries and invalid input blocked before a request.
This is an AI-assisted engineering sample, not a client deployment. The HTTP failures are controlled test cases; real transport failures and production monitoring require separate handling.
[See the workflow, source files and verification results](https://www.twine.net/signin