Category
決済・課金(Stripe / サブスク / 冪等性)の実装ガイド
決済は「正しさ」を運用の注意深さではなく、コードの構造で保証する領域です。ネットワークは切れ、リクエストは重複し、Webhookは順不同で二重に届く——これを前提に、冪等性キー・署名検証・状態機械・サーバー側を真実源とする設計で、二重課金や残高不整合を構造的に不可能にします。Stripe実装から、AWSサーバーレスでの決済信頼性レイヤーまでを扱います。
7 articles in total
Foundational guide
Foundational guide (start here)
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.
Related practical articles
- AWSDynamoDBPythonサーバーレスアーキテクチャ設計
Designing 'zero double charges' in a serverless payment foundation — implementing idempotency, atomicity, and zero-downtime migration with DynamoDB
The reliability-layer design of a serverless payment foundation that handles actual money. Based on real code, it explains the implementation patterns that prevent double charges with idempotency keys and conditional writes, guarantee balance consistency with DynamoDB transactions, and evolve the schema without stopping production with dual writes.
15 min read - Stripe決済サブスクリプションNext.jsTypeScript
Stripe Billing implementation guide (2026 edition, official-compliant): subscriptions, usage-based (Billing Meters / Metronome), customer portal, and proration in real code
A Stripe-Billing-official-compliant implementation guide. It explains, in Next.js 16 + TypeScript real code, starting a subscription (Checkout / Subscriptions API), usage-based (Billing Meters), the Customer Portal, proration, and idempotent webhook processing.
18 min read - Stripe決済Next.jsTypeScriptWebhook
The Complete Guide to Implementing Stripe Payments at Production Quality (2026 Edition, Official-Documentation-Conformant): Checkout Sessions, Webhooks, Idempotency, and Connect in Real Code
An implementation guide to production payments faithful to the Stripe official documentation. We implement hosted/embedded payments on Next.js 16 with the 2026-standard Checkout Sessions API, process Webhooks idempotently as the single source of truth, prevent double charges with Idempotency-Key and event.id, and handle marketplaces with Connect. With practical knowledge from 0 double charges in production.
20 min read - StripeStripe Connect決済AWSアーキテクチャ設計
Stripe Connect Marketplace Payments Production Guide: Safely Designing Account Types, Charge Models, and Webhook Idempotency
An implementation guide for building marketplace / platform payments in production with Stripe Connect. Explained with real code: account types (Standard/Express/Custom), the direct/destination/separate charge models, application fees, Account Links onboarding, Webhook signature verification and idempotency, and the security of server-side amount resolution.
23 min read - StripeB2B SaaSTypeScriptアーキテクチャ設計決済
The Stripe Implementation Guide to Recovering Subscription Revenue 2026: Reducing Involuntary Churn with Payment Failures, Dunning, and Smart Retries
A Stripe implementation guide to stopping the 'quiet revenue leak' = involuntary churn of subscriptions. We explain — in real TypeScript code — the payment-failure state machine (active→past_due→unpaid/canceled), idempotent Webhook processing, the use distinction between Smart Retries and custom retries, dunning emails and SCA re-authentication in the customer portal, and permission control that respects past_due.
21 min read - B2B SaaSアーキテクチャ設計Next.jsTypeScriptStripe
Dissecting the Architecture of a Subscription Learning Platform: Multi-Channel Billing, Idempotent Payments, Agency Commissions, and Type-Safety Discipline
A dissection of a financial-literacy education subscription platform built as a Next.js 16 × Prisma monorepo, with real code as the single source of truth. Explained at the implementation level: a pure function that deterministically resolves pricing from 6 input sources, the idempotency / ordering guarantees / PII redaction of Stripe Webhooks, the state machine of bank-transfer subscriptions, the append-only ledger of agency commissions, tokenVersion and OTP authentication, and exhaustiveness checking via NeverError.
18 min read