Skip to content
Code Recycle

Component · for humans & their agents

Webhook Fulfillment Kit

verified · first-partyactively maintainedFree

An order gets fulfilled twice, or a paid order never gets fulfilled at all. Both, prevented.

by ringbuffer · Code Recycle admin

Get it free

Every claim on this page is refundable if it is untrue — refund policy.

Verified: 23 tests

Building it yourself: ~2.3h of agent time across about 4 attempts. Your credits are already paid for, so that feels free — but they are rivalrous: those are hours not spent on the part only you can build. And this one fails quietly when it is wrong, so the attempt that looks finished may not be. Take it free and spend the hours on something else.

Deliver-once fulfillment for payment webhooks that arrive twice, out of order, or at the same moment as the browser redirect. Zero dependencies, no provider SDK, no framework — you bring a small store, it handles the ordering, dedupe, and error isolation. 23 tests, each named after a failure that cost real money.

The five failures it prevents

Every one of these happened in a production Stripe integration before it became a rule here:

1. Two winners, one job. The success redirect and the webhook race each other and both try to fulfill. Whoever loses must return *success* — the buyer paid, and the second caller is not an error case. 2. Retries are not duplicates. Providers retry on any non-2xx. Return 500 on an event you already processed and you receive it forever. 3. A non-critical side effect must never abort fulfillment. A seller payout that threw stranded *paid* orders mid-provisioning. Entitlement first; everything optional degrades to pending. 4. Out-of-order delivery is normal. A terminal state must never be walked backwards by a late-arriving earlier event. 5. Verify before you trust. The signature check runs before the body is parsed as anything meaningful; a failure is a 400 that never reaches fulfillment.

Why not just generate it

The code isn't the scarce part — that list is. This package's own test suite caught a double-fulfillment bug in its own first draft: `processing` was a legal source state for the atomic claim, so the second racer re-claimed an in-flight order and both fulfilled. That is precisely the bug the kit exists to prevent, written by someone who had just finished writing down the rule.

Proof

23 tests, including a real concurrency test that fires the redirect and the webhook simultaneously and asserts the work happened exactly once.

What you implement

A store with four single-query methods. The important one is `compareAndSetState` — a single `UPDATE ... WHERE state IN (...)` that reports whether the row changed. That return value is the entire race resolution. An in-memory implementation ships for tests.

Delivery

Source delivered as a private repository invite within 24 hours of purchase. Single-product commercial license: use and modify in any number of products; no redistribution or resale of the source.

Interface

What you call, and what comes back. Types and signatures only — the implementation ships with the source.

  export async function fulfillOnce( store: FulfillmentStore, input: FulfillInput, ): Promise<FulfillOutcome>;
  export function createMemoryStore(seed: OrderRecord[] = []): FulfillmentStore &;

01Capabilities

Does

  • + Webhooks
  • + Idempotent fulfilment

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

0 open · 0 answered · 0 fixed · 1 said it worked

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 10 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
1.0.0stableAug 1, 2026First public release.