- Home
- Skills
- Finance & Accounting
- Payment & Ledger Code Review: stop money bugs
Works with the AI Agents you already use
Payment & Ledger Code Review: stop money bugs
Review payment, wallet and ledger code for double charges, float rounding, missing idempotency keys, unverified webhooks and broken double-entry, with a fix and a test for every issue.
Free
Payment & Ledger Code Review: stop money bugs
Example session with this skill installed
Review our checkout and wallet code before launch. We use Stripe and a Postgres ledger. Find anything that could double-charge or lose money.
- Read your context and instructions
- Compiled the payment & ledger
Summary
Scanned 4 files:
9 high, 3 medium, 1 low. Two issues can charge a customer twice or accept a forged payment today; fix those before launch.
High findings
| Location | Issue | Impact | Fix |
|---|---|---|---|
checkout.py:6 | PaymentIntent.create with no idempotency key | A network retry or double-click creates a second charge | idempotency_key=f"order-{order.id}-attempt-{attempt}" |
webhook.js:1 | Webhook handler never verifies the Stripe signature | Anyone can POST a fake payment_intent.succeeded and get goods free | stripe.webhooks.constructEvent(rawBody, sig, secret) on the raw body |
webhook.js:5 | Signature compared with === | Timing side channel | crypto.timingSafeEqual |
checkout.py:4, webhook.js:6 | Amount converted to float | Cents lost or gained in conversion | Decimal(str) / integer minor units |
Wallet.cs:2-3 | Balance and amount are double | Rounding drift in wallet balances | decimal or long minor units |
schema.sql:1 | amount FLOAT column | Inexact stored amounts | NUMERIC(19,4) or BIGINT minor units |
schema.sql:3 | DELETE FROM ledger_entries | Audit trail destroyed; balances cannot be rebuilt | Post a reversing entry instead |
Fix example
from decimal import Decimal, ROUND_HALF_UP
total = (Decimal(order["amount"]) * Decimal("1.2")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
stripe.PaymentIntent.create(amount=to_minor(total, "USD"), currency="usd",
idempotency_key=f"order-{order['id']}-attempt-{attempt_id}")
Tests to add
- Same checkout request twice: one charge.
- Same webhook event twice: one ledger transaction.
- Two concurrent debits on one wallet: balance never negative.
- JPY (0 decimals) and KWD (3 decimals) amounts.
Medium and low
round(total * 100) (float rounding, hard-coded x100), toFixed(2) on a float, and SET balance = balance - 500 outside a visible ledger transaction: confirm it runs with a row lock in the same transaction as the entry.
Connects securely to your tools. The creator never sees your data.
About this skill
Money bugs rarely crash. They double-charge on retry, lose cents in rounding, let two requests spend the same balance, or mark an order paid from an unverified webhook. This skill makes your agent review payment code the way a fintech architect would.
What it does
- Scanner for Python, JS/TS, C#, Java/Kotlin, Go, PHP, Ruby and SQL: money in floats, float rounding, hard-coded x100 minor units, payment API calls without idempotency keys, webhooks without signature checks, signatures compared with
==, ledger rows updated or deleted. - Guided trace of each money flow: retries and timeouts, concurrent debits, debits = credits, rounding and allocation, webhook ordering and replays.
- 10-section checklist: money representation, double-entry, idempotency, concurrency, webhooks, refunds and disputes, FX, reconciliation, PCI scope, tests.
- Report with the scenario that triggers each bug, its impact, a code fix and the test to add.
How it works
- Scope the providers (Stripe, Adyen, PayPal, bank APIs) and flows.
- Run the bundled scanner (standard-library Python, no network calls) and confirm each hit in context.
- Trace the money flows by hand with the checklist.
- Write
payment-review.mdwith fixes, tests to add and checklist results.
Read-only: it never calls payment providers, moves money or changes data.
What's included
SKILL.md, scripts/money_lint.py, a 10-section ledger review checklist, and bad and good code samples.
Known limitations
- Pattern matching finds common mistakes, not logic errors; the manual trace is the core of the review.
- Engineering review only, not a PCI DSS assessment or accounting advice.
Built by the founder of Datazo InfoTech, which builds payment and banking platforms.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 8 days ago
- Free with an Agensi account
- Software
Python 3.9+
Permissions
What's inside
Frequently Asked Questions
New in Finance & Accounting
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Finance & Accounting.