Skip to content

0.5.0 — 409 operation_in_flight

Choose a tag to compare

@Hitek-cel Hitek-cel released this 15 Nov 04:41
· 10 commits to main since this release
  • Added latch.http(httpServer): a payment still in flight gets
    409 operation_in_flight, not a 402.
    The proposed x402 recovery extension
    (x402-foundation/x402#3848,
    §5.1(6)–(7), control 9) says a copy that loses the claim, or a retry while a
    settle is unresolved, MUST NOT get a payment challenge: a 402 invites a second
    signature for one purchase. The SDK turns every hook refusal into a full 402,
    and hooks cannot choose the status, so latch.http() wraps the SDK's
    x402HTTPResourceServer and rewrites only the refusals Latch made as
    "in flight". It also covers the SDK's own settlement-failure 402 when the
    payment could still land. Every other answer is unchanged.

    app.use(paymentMiddlewareFromHTTPServer(latch.http(new x402HTTPResourceServer(server, routes))));
  • A stuck payment's retry is now refused as payment_unresolved (409
    with latch.http()), not payment_closed: its outcome is unknown, so the
    purchase stays blocked and the caller is never invited to sign again.

  • The demo uses latch.http(); steps 3 and 4 now show the 409.

Also the first npm release of the 0.4.0 and 0.4.1 changes, which were never
published on their own:

  • journalReport(sql): a read-only, self-contained HTML dashboard of every
    payment in a Postgres journal — where each one ended, activity over time,
    recoveries, filters, CSV export, light and dark themes.
  • journalReportData(sql): the same data as plain objects.
  • npm run report opens that page for the demo's payments.

Full details in CHANGELOG.md.

npm install latch402@0.5.0