Skip to content
← Writing

2026-03-01 · 6 min read

Shipping Stripe payments on a Next.js product

Why a Stripe success redirect is not payment state, and how a server session plus webhooks keeps the product and the provider in agreement.

The problem

A checkout button can succeed in the browser while the product still thinks the payment is unpaid, or the reverse. Amounts, approval state, and provider status have to agree, and the page is the wrong place to decide that.

Server session, then recorded status

Create the payment on the server. The route checks the signed-in user, the amount, and any product rule before it asks Stripe for a Checkout Session or PaymentIntent. The browser only receives what it needs to continue, not the authority to mark the order paid.

Treat the return URL as navigation. The status that matters is the one written when Stripe sends a webhook. The UI then reads that recorded state: paid, failed, or still waiting.

Keep product rules out of the provider

Spend limits and extra approvals belong in the application. The provider confirms that money moved. Mixing those two jobs makes a declined approval look like a failed charge, or a successful charge look like permission.

On platforms like COOWN, group payments are validated by backend services, which apply limits and approval policies before anything is treated as sent. Account and payment statuses are confirmed after backend providers process them. The interface reflects recorded server state rather than initiating direct transfers.

The pitfall

The usual bug is unlocking the product on the success redirect. Refresh the page, miss the webhook, or open the link twice, and the UI and the ledger diverge. Wait for the webhook write, then render that status.

Related case studies

  • COOWN — A treasury workspace that helps organizations manage shared accounts, spending controls, approvals, and invoicing in one place.