Stop double credits and duplicate receipts in payments

    1

    What is inside: SKILL.md, failure-semantics table, PR review checklist; scripts/webhook_outbox_model.py (SQLite reference with an 8-thread race test, --self-test and --demo).

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Stop double credits and duplicate receipts in payments

    Example session with this skill installed

    Command: python3 scripts/webhook_outbox_model.py --demo (five webhook calls for one order: first receipt send fails, then replays, a refund, and a late settlement callback)

    • Read your context and instructions
    • Compiled the stop double credits
    call 1: status=settlement -> (503, 'settled+send_failed')
    call 2: status=settlement -> (200, 'replay+sent')
    call 3: status=settlement -> (200, 'replay+duplicate')
    call 4: status=refund     -> (200, 'reversed')
    call 5: status=settlement -> (200, 'terminal')
    

    ledger: [('credit', 5000), ('reversal', -5000)]
    delivery: [('email:paid:ord-1', 'sent', 2)]
    Note: Real output of the bundled reference model.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    What it does: a provider-agnostic method for payment callbacks that grant credits, orders, subscriptions or licenses and send a notification. It separates provider authentication, status verification, settlement and notification; shows which payload fields a signature really covers; classifies unknown statuses as review, never success; guards every transition in the UPDATE itself; routes every entry point (admin approval, manual transfer, legacy endpoints) through one settlement function; handles refunds as terminal states; and builds a notification outbox whose zero-row claims are classified (duplicate, in progress, stale, exhausted) instead of assumed duplicate. Ends with staged activation and an honest readiness ladder. Who it is for: developers integrating any payment provider, and reviewers checking such code before launch. What is inside: SKILL.md, failure-semantics table, PR review checklist; scripts/webhook_outbox_model.py (SQLite reference with an 8-thread race test, --self-test and --demo). Limits: not provider-specific documentation; you still follow your provider's signature and API docs. Not legal or compliance advice.

    • Provider-neutral: signature formats and status names must come from your provider's docs.
    • The reference model is single-file SQLite for clarity, not a production library.
    • Exactly-once external delivery is impossible without provider idempotency support; the skill documents the trade-off instead of hiding it.
    • Does not cover tax, invoicing law or PCI scope.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    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 forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed today

    • Free with an Agensi account

    Requires

    Git

    Permissions

    Terminal / Shell
    Read Files
    Network Access
    Listedtoday

    What's inside

    Frequently Asked Questions

    Any. The method is provider-neutral; you plug in your provider's signature check and status API.

    A signature only covers the fields in its digest. The skill shows how to check coverage and fetch status server-to-server for anything not covered.

    Settlement stays. The delivery row is retried by a real dispatcher with the same idempotency key, and exhausted deliveries end explicitly with an alert.

    It is a runnable reference and test list. Port the SQL patterns and keep the tests as acceptance criteria.

    Yes. Refunds and chargebacks are terminal states with a unique reversal ledger row, and a late settlement callback cannot resurrect a refunded order.

    New in APIs & Backend