Who asked: Amara Lindgren, head of finance operations at Tallyway Payments.
Why: Merchants are paid from a settlement report. A duplicated transaction once paid a merchant twice; Amara wants the pipeline to stop rather than publish wrong amounts, and to be told when the report is stale.
The data: payments.fetch_transactions() returns the processor's export, which can repeat a transaction. Settled payments and refunds count toward settlements; pending ones do not.
Done looks like: deduplicated transactions, settlements per merchant, a blocking uniqueness check, a 24-hour freshness policy and a schedule at 2:00 UTC that runs by default.
Build a settlement pipeline with the safeguards a payments company needs. Each step starts from your previous code.