[{"data":1,"prerenderedAt":159},["ShallowReactive",2],{"content-\u002Fblog\u002Fhandling-financial-logic-in-backend-systems":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"tags":11,"readingTime":16,"draft":6,"body":17,"_type":153,"_id":154,"_source":155,"_file":156,"_stem":157,"_extension":158},"\u002Fblog\u002Fhandling-financial-logic-in-backend-systems","blog",false,"","Handling financial logic in backend systems","Money math, idempotency, and transactional boundaries for backend engineers building fintech and enterprise financial workflows.","2026-04-22",[12,13,14,15],"Fintech","Backend","Financial Logic","Enterprise","6 min",{"type":18,"children":19,"toc":144},"root",[20,36,43,48,54,59,65,77,83,97,103,108,114],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25,28,34],{"type":26,"value":27},"text","Financial logic is where “it works on my machine” stops being funny. A fintech software engineer treats money movement as ",{"type":21,"tag":29,"props":30,"children":31},"strong",{},[32],{"type":26,"value":33},"data with invariants",{"type":26,"value":35},", not as floating-point convenience.",{"type":21,"tag":37,"props":38,"children":40},"h2",{"id":39},"prefer-integers-and-explicit-currency-rules",[41],{"type":26,"value":42},"Prefer integers and explicit currency rules",{"type":21,"tag":22,"props":44,"children":45},{},[46],{"type":26,"value":47},"Store amounts in minor units (cents) or use a decimal type your database and runtime agree on. Never let presentation formatting leak into core calculations. Round only at well-defined boundaries—usually when displaying or when a contract says so.",{"type":21,"tag":37,"props":49,"children":51},{"id":50},"idempotency-is-non-negotiable",[52],{"type":26,"value":53},"Idempotency is non-negotiable",{"type":21,"tag":22,"props":55,"children":56},{},[57],{"type":26,"value":58},"Network retries will happen. Use idempotency keys on write endpoints that create charges, transfers, or ledger entries. The second request with the same key should return the same outcome as the first, without duplicating side effects.",{"type":21,"tag":37,"props":60,"children":62},{"id":61},"transactional-boundaries-should-match-the-business-story",[63],{"type":26,"value":64},"Transactional boundaries should match the business story",{"type":21,"tag":22,"props":66,"children":67},{},[68,70,75],{"type":26,"value":69},"A single “repayment applied” operation might touch balance, ledger row, and schedule row. Those updates belong in one ",{"type":21,"tag":29,"props":71,"children":72},{},[73],{"type":26,"value":74},"transactional boundary",{"type":26,"value":76}," so partial failures do not leave half-truths in the database. If the workflow spans services, design compensating actions or outbox patterns—avoid “best effort” distributed commits unless you truly need them.",{"type":21,"tag":37,"props":78,"children":80},{"id":79},"see-it-in-a-shipped-surface",[81],{"type":26,"value":82},"See it in a shipped surface",{"type":21,"tag":22,"props":84,"children":85},{},[86,88,95],{"type":26,"value":87},"When UI and API disagree, users lose confidence. A full-stack view of the same rules—like the ",{"type":21,"tag":89,"props":90,"children":92},"a",{"href":91},"\u002Fprojects\u002Floan-management-platform",[93],{"type":26,"value":94},"loan management platform case study",{"type":26,"value":96},"—shows how explicit backend contracts keep dashboards honest.",{"type":21,"tag":37,"props":98,"children":100},{"id":99},"testing-the-scary-paths",[101],{"type":26,"value":102},"Testing the scary paths",{"type":21,"tag":22,"props":104,"children":105},{},[106],{"type":26,"value":107},"Focus tests on: reversals, partial payments, duplicate webhooks, clock skew around cutoffs, and currency edge cases. Property-based tests can help for schedule generators when inputs have wide variance.",{"type":21,"tag":37,"props":109,"children":111},{"id":110},"summary",[112],{"type":26,"value":113},"Summary",{"type":21,"tag":22,"props":115,"children":116},{},[117,122,124,129,130,135,137,142],{"type":21,"tag":29,"props":118,"children":119},{},[120],{"type":26,"value":121},"Integers or decimals with discipline",{"type":26,"value":123},", ",{"type":21,"tag":29,"props":125,"children":126},{},[127],{"type":26,"value":128},"idempotent writes",{"type":26,"value":123},{"type":21,"tag":29,"props":131,"children":132},{},[133],{"type":26,"value":134},"clear transactions",{"type":26,"value":136},", and ",{"type":21,"tag":29,"props":138,"children":139},{},[140],{"type":26,"value":141},"tests on failure paths",{"type":26,"value":143}," are the backbone of maintainable financial backends—whether you call yourself a loan system developer or a general backend engineer.",{"title":7,"searchDepth":145,"depth":145,"links":146},2,[147,148,149,150,151,152],{"id":39,"depth":145,"text":42},{"id":50,"depth":145,"text":53},{"id":61,"depth":145,"text":64},{"id":79,"depth":145,"text":82},{"id":99,"depth":145,"text":102},{"id":110,"depth":145,"text":113},"markdown","content:blog:handling-financial-logic-in-backend-systems.md","content","blog\u002Fhandling-financial-logic-in-backend-systems.md","blog\u002Fhandling-financial-logic-in-backend-systems","md",1777380682581]