The claimTxHash flow is designed so the worker's payment-confirm job can
finish confirming a payment even after the buyer closes the tab (an agent
that never polls hits the same path). But the job only flipped the payment
to "confirmed" and emitted the webhook — it never completed the checkout
session or created an entitlement, both of which only happened in the
buyer-driven confirmOnce/fulfillOnce flow and the API's /payments/:id/confirm
route.
Result: a payment the worker confirms settles on-chain and fires the
seller's webhook, but the session stays "open" forever, so the success/
receipt page 409s "not paid yet" indefinitely and no entitlement is ever
created — the GitHub/Discord retry jobs have nothing to retry since they
only act on entitlements that already exist.
Add WorkerStore.saveCheckoutSession (in-memory + Postgres) and complete the
session + grant a payment entitlement per line item right after the worker
confirms a payment, guarded against double-granting.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every seller webhook delivery now keeps an attempt log (status code,
error, time, next retry) in the worker queue (Postgres) or in memory.
New routes: GET /v1/webhooks/deliveries(/:id), POST
/v1/webhooks/events/:id/resend, POST /v1/webhooks/endpoints/:id/test
(signed webhook.test event), rotate-secret with a 0-168h grace window
(both secrets sign as two v1 values, verified by @settlekit/webhooks, the
TS/Python/Go/Rust SDKs and the WooCommerce plugin), and disable/enable.
The worker retries on a 1m..6h exponential schedule instead of every tick,
signs with the live endpoint secret, skips disabled endpoints and
auto-disables one after 100 failed attempts in a row
(WEBHOOK_DISABLE_AFTER_FAILURES). Outbound requests get a 10s timeout.
The dashboard Webhooks page shows the event log with Resend and endpoint
actions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invoices can now be paid onchain. POST /v1/invoices/:id/send issues the
invoice, binds a public pay page (/i/<token> on the hosted checkout),
opens a checkout session for the invoice total on the merchant's
networks and emails the link. POST /v1/invoices/requests sends an
ad-hoc amount + memo to an email. The invoice turns paid only when a
confirmed onchain payment exists for one of its sessions (on read in the
API and in the new worker invoice-settle job) and emits invoice.paid.
Invoice and receipt PDFs render with pdfkit (MIT). Voiding cancels open
sessions. Dashboard gets a request-a-payment form, send buttons, pay
links and PDF downloads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- jobs/route-watch.ts: polls in-flight any-token routes (Relay / LI.FI) and
records a payment ONLY after the destination fill passes the session
network's fail-closed verifier (Transfer to payTo >= amount owed, after
session creation, hash not used by another payment); provider success
without such a transfer stays unpaid and backs off; refunds are logged
- payment verification: hypercore via the payee's ledger (HYPERCORE_*),
routed fills skip only the payer / Solana reference / Tempo memo bindings
(Solana fills are bound by block time), requireMemo sessions need
transferWithMemo, pending results carry retryable/claimable
- config: HYPERCORE_*, ROUTING_*, WORKER_ROUTE_WATCH_INTERVAL_MS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checkout stores a GitHub entitlement as pending when the merchant's GitHub
App is not set up yet (or GitHub fails) and nothing retried it. The new
github-delivery-retry job (every 2 min, WORKER_GITHUB_RETRY_INTERVAL_MS)
re-delivers pending repo/team entitlements of confirmed payments through
the real GitHub App access client once an installation id is configured,
then marks them active. Targets come from the entitlement or product
metadata and the username from the checkout session; payments owned by the
delivery runner are skipped; failures back off 5 min doubling to 6 h.
The worker also accepts GITHUB_APP_INSTALLATION_ID (the checkout's name)
and gains WorkerStore.getProduct for product delivery metadata.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cherry-picked fail-closed payment fixes imported @settlekit/solana, which
does not exist on this branch, breaking tsc -b and the api/worker suites.
Solana verification, env and session references are removed; arc/base/
ethereum keep the per-network verifier registry and the worker keeps
payTo-bound verification. A solana network is now rejected as unsupported
(400 on checkout/observe, unsupported in the worker). Also adds the missing
packages/circle project reference to the api, points the api/worker test
scripts at the root vitest config, and removes the operator's
vitest.apps.config.ts workaround.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each run expires stale escalations (vault-held ones on-chain, bills closed
as rejected), turns confirmed Arc payments into the operator vault without
a decision into revenue.received (payer read from the USDC transfer), raises
bill.due for open bills inside the due window, and emits one tick per UTC
day. Event ids are deterministic so nothing is decided twice. The API and
worker only run the operator with OPERATOR_VAULT_ADDRESS set or an explicit
OPERATOR_SIMULATION=1; otherwise the job no-ops and the routes answer 503.
Registered with one export in jobs/index.ts and one scheduler entry in
runtime.ts (the scheduler lists jobs explicitly).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- config: loadEvmChains + Zcash (ZCASH_ENABLED, explorer, confirmations)
and WORKER_ZCASH_WATCH_INTERVAL_MS (default 90s)
- payment verification routes every EVM key through @settlekit/chains
(Arc moves onto the same path; chain-id asserted), Solana as before, and
Zcash against the locked quote; late Zcash payments go to manual review;
payTo resolves per network and acceptedNetworks is honoured
- new zcash-watch job: no network call unless open watchable Zcash
sessions exist, one explorer call per payTo, exact-amount match, attaches
or records the pending payment and never reuses a txid
- chains: transport failures are retryable rpc_unavailable, never paid
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The payment-confirm job verified every pending payment on Arc with
to = the USDC contract address instead of the merchant's payTo, so a
transfer to anyone could confirm. It now loads the payment's checkout
session (new WorkerStore.getCheckoutSession, in-memory + Pg) and routes
by network: Arc via the Arc client against session.payToAddress, Solana
via @settlekit/solana (base58 signature, session paymentReference, no
0x check). Networks the worker cannot verify (base/ethereum, or solana
without SOLANA_CLUSTER) stay pending — fail closed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The payment-confirm job verified every pending payment on Arc with
to = the USDC contract address instead of the merchant's payTo, so a
transfer to anyone could confirm. It now loads the payment's checkout
session (new WorkerStore.getCheckoutSession, in-memory + Pg) and routes
by network: Arc via the Arc client against session.payToAddress, Solana
via @settlekit/solana (base58 signature, session paymentReference, no
0x check). Networks the worker cannot verify (base/ethereum, or solana
without SOLANA_CLUSTER) stay pending — fail closed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>