Skip to main content
友田 陽大

Category

決済・課金(Stripe / サブスク / 冪等性)の実装ガイド

決済は「正しさ」を運用の注意深さではなく、コードの構造で保証する領域です。ネットワークは切れ、リクエストは重複し、Webhookは順不同で二重に届く——これを前提に、冪等性キー・署名検証・状態機械・サーバー側を真実源とする設計で、二重課金や残高不整合を構造的に不可能にします。Stripe実装から、AWSサーバーレスでの決済信頼性レイヤーまでを扱います。

7 articles in total

Foundational guide

Foundational guide (start here)

Stripe
TypeScript
B2B SaaS
アーキテクチャ設計
Next.js

Implementing Stripe Webhooks and Idempotency at Production Quality: Signature Verification, Out-of-Order / At-Least-Once Delivery Resistance, the Subscription State Machine

A 'doesn't-break' payment implementation guide faithful to the Stripe official documentation. Explained with working TypeScript code: idempotent API calls with an Idempotency-Key, Webhook signature verification (raw body required) and resistance to double delivery / out-of-order, the technique of designing the subscription lifecycle as a state machine, and verification with the Stripe CLI.

22 min read

Related practical articles