← ClaudeAtlas

payment-basicslisted

Gateway-agnostic payment integration rules - idempotency, webhook/callback verification, amount checks, reconciliation, PCI scope and secrets handling. Use when the user asks how to make a payment integration safe or correct in general, reviews a payment flow, asks "is my webhook secure", "how do I avoid double charging / double fulfilment", "do I need PCI compliance", or designs checkout, callbacks or refunds without naming a gateway. For gateway-specific signatures, fields and endpoints use that gateway's own skill (payhere, onepay, webxpay, genie, koko) alongside this one.
psnwd/getewise · ★ 0 · Code & Development · score 72
Install: claude install-skill psnwd/getewise
# Payment basics Rules that hold for every gateway. This skill has no gateway API facts; signature formulas, field names and endpoints live in the gateway skills. Say so and defer rather than guess. ## 1. The browser is not proof of payment Redirect/return pages are for the customer. Mark an order paid only from a **verified server-to-server callback** or a **status API lookup** you made yourself. ## 2. Verify every callback, in this order 1. Read the **raw body** (re-serialised JSON/forms break signatures). 2. Verify the signature/hash with the gateway's scheme; compare with a **constant-time** function (`hmac.compare_digest`, `crypto.timingSafeEqual`, `hash_equals`). Bad signature: reject (400), log, do nothing else. 3. Load the order by **your** id. Unknown: 404. 4. Check **amount, currency and merchant id** against your DB, not against the callback alone. 5. Check state and idempotency (section 3), then update, then return 200. 6. If the gateway gives a timestamp/nonce, reject stale ones; if it offers a status API, confirm there before fulfilling high-value orders. Callback routes: exempt from CSRF and session auth, POST only, no redirects, fast (queue slow work), always 200 once handled so the gateway stops retrying. ## 3. Idempotency Callbacks repeat, arrive out of order and race with the return page. Make "mark paid" safe to run twice: - Unique constraint on `(provider, gateway_ref)`; insert first, fulfil only if the insert was new. - Forward-only state machine: `