Skip to content
Development
Command

/harden

Audit a hand-written payment integration and FIX what it finds. Unlike /pagokit:doctor, which is read-only, this one writes.

From plugin
pagokit
708 skills1 agent8 commands5 hooks
> /plugin marketplace add Hainrixz/agente-pagokit
> /plugin install pagokit@tododeia

Command definition

harden.md
description: Audit a hand-written payment integration and FIX what it finds. Unlike /pagokit:doctor, which is read-only, this one writes.
argument-hint: "[--dry-run]"

/pagokit:harden

For integrations PagoKit did not write. Most payment code in the world was written by hand and has at least one of the silent failures the validators exist to catch.

Run `--dry-run` first by default, and only write after the user has seen the list.

1. Find the integration

Glob for webhook routes, payment SDK imports, checkout endpoints and migrations. Identify the provider from the SDK import and the key prefixes in `.env.example` — matched against the catalog's `detection` and `credentials` entries, not guessed.

2. Run every validator against the existing files

The checks in `hooks/checks/` are ordinary functions. Call them directly on each candidate file rather than waiting for a write to trigger them:

node -e "
const check = require('./hooks/checks/webhook-has-signature');
console.log(check.run({ filePath: '<path>', content: require('fs').readFileSync('<path>','utf8'), toolName:'Write', projectDir: process.cwd() }));
"

Do this for every rule, on every payments file. That is the whole audit — the same checks that would have blocked the code as it was written.

3. Check what the validators cannot see

  • Does the handler verify with the **webhook secret**, not the API key? These are different

values and mixing them fails silently forever.

  • Is there replay protection at all — a timestamp window, or dedup against a persisted event

id? Signature verification alone does not stop replay.

  • Are the amounts converted at the **currency's** exponent? Check `currencies.json`.
  • Is there a refund path on a rail where refunds do not exist?
  • Are all of the provider's `required_events_minimum` routed, or does the switch silently drop

the ones nobody thought about — `charge.dispute.created`, `subscription.payment_failed`?

  • Is `.env` gitignored, and has it ever been committed? `git log --all --full-history -- .env`

answers that, and the answer is sometimes yes.

4. Report, then fix

PagoKit hardening report — <provider> · <n> files audited

CRITICAL   <what an attacker or a bug can do today, in one line>
HIGH       ...
MEDIUM     ...

<n> critical · <n> high · <n> medium

Order by what an attacker can actually do, not by rule number. An unsigned webhook is not "one finding among five" — it means anyone who knows the URL can grant themselves a paid account.

Then fix them one at a time, smallest blast radius first, running the test suite between changes if the project has one. Write `PAGOKIT_INTEGRATION.md` at the end so `/pagokit:doctor` can audit it from now on.

Anti-patterns

  • Do not rewrite a working integration wholesale. Fix the specific defects.
  • Do not change the provider. That is `/pagokit:migrate`.
  • Do not "fix" something by adding a `pagokit-ignore` comment.
  • Do not touch a live key, or move a project from test to live mode.
  • If a fix would change behaviour visible to customers — a different webhook URL, a new

required env var — stop and say so before writing.

Read more
@hainrixz
Ships withpagokit

Claude Code plugin that picks and implements the right payment method for your app — from your terminal. 42 providers, 136 payment rails, and deterministic validators that block insecure payment code as it is written.

708 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
70
Star history of Hainrixz/agente-pagokit on GitHub, a chart by star-history.com

Other commands on pagokit.

add

add

Command

Add a second payment provider alongside an existing integration, without touching the one already running.

@hainrixz@hainrixzInstall Command
compare

compare

Command

Compare two or more payment providers head to head for a concrete situation — real fees on a real amount, coverage, onboarding…

@hainrixz@hainrixzInstall Command
coverage

coverage

Command

Show what you can actually use in a given country — providers, local rails, currency exponent, e-invoicing obligation, and…

@hainrixz@hainrixzInstall Command
doctor

doctor

Command

Audit an existing PagoKit integration — gitignore, env vars, key prefixes, webhook secret, raw body, replay protection,…

@hainrixz@hainrixzInstall Command
migrate

migrate

Command

Migrate from one payment provider to another, keeping the old one running until the new one is proven.

@hainrixz@hainrixzInstall Command
start

start

Command

Analyze the current project and generate a production-ready payment integration (frontend + backend + webhook + DB + portal +…

@hainrixz@hainrixzInstall Command

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command