Stripe payments¶
Always-on rule for stripe-payments · Source
- Create the PaymentIntent or Checkout Session on the server from the order total, with
metadata[order_id]and anIdempotency-Keyper attempt. - Send amounts as integers in the currency's smallest unit. Respect zero-decimal currencies.
- Only the
client_secretor Checkouturlreaches the browser. Thesk_key stays on the server. - Mark orders paid from a verified webhook:
payment_intent.succeeded, orcheckout.session.completedwithpayment_statuspaid. - Verify
Stripe-Signatureon the raw body with thewhsec_secret, a 300 second tolerance, and a constant-time compare. - Deduplicate on
event.id. Compareamount_receivedandcurrencywith the order. - Refund with
POST /v1/refundsand an idempotency key. Track pending refunds fromrefund.updated. - Never treat the
return_urlvisit as proof of payment.