payment-trading-extension

Enforce idempotency, double-entry ledger invariants, and webhook verification for payment and trading workflows.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill payment-trading-extension
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: payment-trading-extension
Source: https://github.com/machenjie/rd-skills/tree/main/src/domain-extensions/payment-trading-extension
Command: npx skills add https://github.com/machenjie/rd-skills --skill payment-trading-extension

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents payment and trading changes from causing double charges, silent ledger drift, incorrect state transitions, and regulatory or PCI compliance failures by enforcing server-authoritative confirmation, idempotency, immutable double-entry accounting, and replay-safe webhook processing.

Core Features & Use Cases

It defines an end-to-end domain discipline for payments, subscriptions, refunds, disputes, trading orders/settlement, and reconciliation workflows that must be correct even under retries, timeouts, and webhook replays. It provides non-negotiable guardrails for payment state machines, idempotency for every payment-mutating operation, immutable ledger writes with double-entry invariants, fixed-point financial arithmetic, and webhook signature verification and deduplication. It is used when implementing or changing checkout/payment intent flows, billing proration and renewals, refund/chargeback handling, ledger and balance logic, webhook endpoints for providers (e.g., Stripe), and reconciliation reporting that must match provider settlement.

Quick Start

Ask the agent to assess a proposed payment, billing, or trading change and produce a pass/block decision based on state machine completeness, idempotency coverage, immutable ledger and double-entry correctness, webhook signature verification with replay protection, fixed-point arithmetic, PCI-safe card-data handling, and daily reconciliation requirements.

Frequently Asked Questions about payment-trading-extension

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent double charges and ledger drift when handling payment webhooks?

To prevent double charges and ledger drift, you must enforce per-operation idempotency keys, verify webhook signatures, and apply replay-safe deduplication for all payment-mutating operations. This ensures duplicate webhook deliveries do not result in multiple ledger entries or entitlement fraud.

What is double-entry bookkeeping invariants for immutable payment ledgers?

Double-entry bookkeeping invariants require that every payment transaction writes matching debits and credits to an immutable ledger, ensuring balances always reconcile to zero. This prevents silent ledger drift and provides an auditable financial state for compliance.

How do I implement idempotency for payment intent and capture workflows?

Implement idempotency by assigning unique per-operation idempotency keys to checkout, payment intent creation, and capture workflows. The server must gate confirmation and reject duplicate mutations using the same key, ensuring retries or timeouts do not trigger duplicate charges.

Why does my payment state machine need exhaustive invalid-transition errors?

A payment state machine needs exhaustive invalid-transition errors to prevent incorrect state progression during billing renewals, refunds, or disputes. Blocking undefined transitions protects against entitlement fraud and ensures server-side confirmation gating remains authoritative.

How do I reconcile ledger balances against provider settlement reports?

Reconcile ledger balances against provider or exchange settlement reports by implementing a reconciliation and monitoring plan with explicit alert thresholds. This detects mismatches between internal double-entry ledgers and external provider reports, preventing compliance failures.

Can I use fixed-point financial arithmetic for trading order position calculations?

Yes, fixed-point financial arithmetic must be used for trading order position calculations and billing proration to eliminate floating-point rounding errors. This enforces precise financial state machine calculations and maintains immutable ledger correctness.