# Psp Integration

> Integrate a PSP correctly: idempotency key on every money operation (charge/refund/payout), verify webhook signatures and handle them idempotently + out-of-order, model the charge state machine explicitly, and handle 3DS/SCA and hard-vs-soft declines.

- Skill: `mcorbett51090/psp-integration` (Agent Skill)
- Install (CLI): `npx get-skill add mcorbett51090/psp-integration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mcorbett51090/psp-integration/raw
- Safety review: pending (external: skill-scanner PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: mcorbett51090 (https://skillmd.com/u/mcorbett51090)
- Updated: 2026-11-19
- Page: https://skillmd.com/skills/mcorbett51090/psp-integration

---


# PSP Integration

## Idempotency everywhere
**Idempotency key** on create-charge, refund, payout. A retry without it **double-bills** — the cardinal sin.

## Webhooks
**Verify the signature** (public, untrusted endpoint). Handle **idempotently** (dedupe by event id) and **out-of-order** (at-least-once). Drive the state machine from verified webhooks.

## State machine
Model requires_action -> processing -> succeeded/failed + refunds/disputes explicitly. Don't infer state from scattered flags.

## SCA + declines
Handle **3DS/SCA** (`requires_action` is normal). Hard declines: don't retry; soft: backoff + dunning.

