Stripe Webhook to Valibot

Paste a Stripe webhook event (checkout.session.completed, payment_intent.succeeded, etc.) and get a Valibot v.object schema you can run inside your handler. Smaller bundle than Zod, same boundary guarantee — useful for Cloudflare Workers and Vercel Edge webhook receivers.

JSON input valid
Valibot output

      
    

About this conversion

Stripe signs every webhook payload, but signature verification only proves the bytes came from Stripe — it doesn't prove the bytes match the shape your handler expects. A Valibot schema generated from a real event payload turns the inner data.object into a runtime-checked shape: parse the body, narrow on event.type, then run the per-type schema's v.parse and you have a strongly typed Session (or Subscription, or Invoice) with no ambient unknowns. The same boundary guarantee Zod gives, but the runtime cost is a fraction — Valibot tree-shakes per primitive, so the handler only ships the v.object, v.string, v.number, v.array, v.union your shape actually uses.

That bundle-size difference matters most where webhook receivers run on edge runtimes: Cloudflare Workers, Vercel Edge functions, Next.js middleware, Deno Deploy, Bun. A typical generated schema for a Stripe event lands at 1-2 KB minzipped — vs. ~14 KB for Zod's full runtime — so cold-start on the receiver shrinks correspondingly. Pasting an event from your Stripe Dashboard's webhook log gives you a copy-paste-runnable v.object with optional fields wrapped as v.optional(...) and nullable values typed as a v.union including v.null().

Same shape, other validators

Other JSON shapes