The rotation grace check used the wall clock while the job used ctx.now(),
so the retry test started failing once its fixed grace date passed.
The repo already declared MIT in package.json and contract SPDX headers;
add the LICENSE file so GitHub shows it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds DeployArcMainnet.s.sol and deploy-arc-mainnet.sh. The script checks the
chain id (5042) and USDC, simulates, prints the cost in USDC, asks for
confirmation, then verifies on Sourcify and Blockscout. Also adds the
bounty runbook. SettleKitCctpHook is excluded: it is not called by CCTP V2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unhandled errors echoed the driver message to the caller, including SQL and
bound parameters. In production the caller now gets a generic message and
the detail is logged server-side with the request id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prices.product_id is a foreign key in Postgres, so saving the price first
made POST /v1/merchant/products fail with a 500 on the live database. The
in-memory repositories never enforced the key; the new test does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checkout fixtures are dated 2026-09-29 but expiry reads the wall clock, so
24 tests started failing once the real date passed the checkout window.
The schema test predated the x402_nonces table, which is keyed by the
claimed authorization instead of id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- POST /v1/auth/register: a merchant always gets a fresh organization; a
caller-supplied organizationId let anyone join an existing seller's org and
receive a platform:admin key (tenant takeover, present on main too).
- Customer (portal) sessions carry the seller's org id; they are now refused
on the management API instead of being treated as the org owner.
- Fee statements: issuance is serialized per merchant+period in-process and a
duplicate raced in by another instance is voided before sending; a draft
left by an interrupted run is sent on the next run. Overlapping runs
previously issued (and emailed) several statements for one month.
- Invoices: SettleKit-owned metadata keys (pay token, session bindings,
settlement facts, fee-statement markers) are stripped from API input, and a
payment from another organization never settles an invoice.
- Scope map: /v1/merchant/refunds/* needs payments:write (was reports:write).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
packages/localization gains the hosted checkout catalog (English source,
complete Spanish), a q-weighted Accept-Language picker limited to en/es
and a placeholder formatter. The checkout app (now depending on
@settlekit/localization) localizes the checkout, payment link, invoice
and success pages plus the order summary, promo, tax and start
components; ?lang=en|es or an sk_lang cookie override the browser
language and <html lang> follows. English output is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /v1/analytics/metrics computes, from live sessions, payments,
subscriptions and catalog: checkout conversion, per-payment-link opened /
paid / conversion / revenue, repeat customers, average revenue per
customer, subscription churn, ARPU and an estimated lifetime value, with
exact bigint money. Checkout repositories gain listCreatedSince
(in-memory and Postgres). The dashboard Analytics page shows the new
cards and a payment-link table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@settlekit/common, @settlekit/sdk and @settlekit/react move to 0.1.0 with
publish metadata (description, MIT licence, repository, public access,
LICENSE and README in the tarball; verified with npm pack --dry-run).
.github/workflows/release-sdks.yml publishes npm, PyPI (trusted
publishing) and crates.io on an sdk-v* tag or as a manual dry run.
docs/RELEASING-SDKS.md lists the owner-only registry setup. Nothing is
published from here. The Python, Go and Rust webhook verifiers already
accept rotated secrets (G8).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merchants can publish a store (slug, title, tagline, https logo, accent
colour, search description, optional custom domain) through settings or
the dashboard. The checkout app serves it at /store/<slug> with SEO and
Open Graph metadata, listing active products (invoice products hidden)
that each open their payment link, and a middleware rewrites '/' on a
merchant's custom domain to its store when CHECKOUT_PRIMARY_HOSTS is set.
Slugs and domains are unique; public data at /v1/public/stores. Carts of
several products stay out of scope because hosted checkout fulfils one
product per session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /v1/merchant/offramp builds sell links for Transak, MoonPay (signed
server-side with the secret key) and Ramp with the amount, network and
the merchant's own receiving wallet prefilled. SettleKit takes no
custody; partners appear only once the owner configures their keys
(TRANSAK_API_KEY, MOONPAY_PUBLISHABLE_KEY/MOONPAY_SECRET_KEY,
RAMP_HOST_API_KEY). The dashboard Balances page gets a Cash out action per
mainnet network.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refunds no longer depend on a pasted hash alone. POST
/v1/merchant/payments/:id/refund/prepare creates a pending refund and
returns the exact transfer back to the buyer: ERC-20 transfer calldata,
token, chain id and an EIP-681 link on EVM networks, or a Solana Pay
transfer request with a unique reference. The destination is the wallet
that paid when known, else the merchant enters it (validated per chain).
POST /v1/merchant/refunds/:id/confirm verifies the signed transfer
onchain with the payment verifiers (destination, amount, time, Solana
reference, one refund per tx) and only then settles: access revoked,
payment refunded once fully refunded, refund.succeeded with source
wallet. Pending refunds can be canceled. Dashboard refund form gets a
'Send from my wallet' mode (browser wallet or mobile link, auto-verify).
apps/refund-protocol stays unwired.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Security fix plus team access. Before this change any valid API key,
including access keys the delivery system hands to BUYERS, authenticated
as the merchant on the whole management API, and GET /v1/api-keys listed
every organization's keys. Now only platform keys (issued at sign-up or
via POST /v1/api-keys/platform, marked with the platform product id) can
call the API, and each request needs its resource scope
(<resource>:read|write, write implies read; platform:admin or * for
full access), answered with 403 and details.requiredScope otherwise.
Keys cannot mint broader keys, customer keys cannot carry management
scopes, key listing is tenant-scoped and keys can be revoked by id.
Dashboard sessions get team roles (owner, admin, developer, support,
viewer) mapped to scopes. /v1/team manages members and email
invitations (packages/invitations, token hash only, 7-day expiry);
/v1/auth/invitations/accept joins the org and creates the account. The
last owner is protected and only owners grant owner. Dashboard: Team
page, invite accept page, and an API keys page that creates restricted
keys and shows the secret once.
Co-Authored-By: Claude Opus 5.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>
Prices can now be set in EUR, GBP and other ECB reference currencies
(displayCurrency + displayAmount, or currency on quick products). Each
checkout converts them to USDC at the live rate from a frankfurter
service (MIT, FX_RATES_URL), rounded half-up to the cent with exact
bigint math, and locks the quote on the session (fxQuote) until it
expires, so onchain verification expects exactly the quoted USDC. Promo,
tax, receipts and the hosted checkout lines use the locked rate; the
payment link page shows the fiat price and today's USDC amount. Missing
or implausible rates fail closed (503); fiat subscriptions and mixed
fiat currencies are refused. Dashboard product form gets a currency
picker.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plugins/woocommerce/settlekit-for-woocommerce charges WooCommerce orders
in USDC: checkout creates a SettleKit payment request for the order total
(no email, return to the order received page) and redirects to the hosted
pay page, reusing an open payment when the buyer comes back. The signed
invoice.paid webhook (?wc-api=settlekit) completes the order after
checking invoice id and amount, and the thank-you page double-checks the
status. Structure ported from btcpayserver/woocommerce-greenfield-plugin
(MIT, 371ebfc) with LICENSE and NOTICE kept. A standalone PHP suite runs
under plain PHP CLI and from vitest, including a cross-check of the PHP
signature verifier against @settlekit/webhooks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apps/checkout/public/embed.js opens a payment link, checkout or invoice
from the same checkout origin in an overlay iframe on any site; links
marked data-settlekit-checkout bind automatically, SettleKit.open() is
available from code, and there is an open-in-new-tab fallback for
wallets that block iframes. The success page posts settlekit:success
only to a site the seller listed under Settings > Embedding
(org embedOrigins, validated https origins), and embed.js only accepts
messages from its checkout frame. Payment requests gain sendEmail and
successUrl so store plugins can redirect buyers and bring them back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New tenant-scoped /v1/exports routes: payments, refunds, invoices and
payouts CSVs, a full USDC ledger, and bank statement files that Xero
(DD/MM/YYYY statement import) and QuickBooks Online (three-column bank
upload) import directly, with optional date ranges. packages/exports
gains a formula-injection guard (opt-in, admin unchanged) and the
accounting formatters. The dashboard Payments page links every export
through a session-authenticated download route.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sellers can turn on checkout tax in settings (label, own country and tax
ID, legal name, per-country rates, default rate, EU reverse charge).
Sessions add tax on top of the net price after any promo, so onchain
verification expects the tax-inclusive total. Buyers set billing country
and VAT ID via the API (billingCountry, vatId) or on the hosted checkout
until a payment is recorded; EU cross-border B2B with a VAT ID of the
right shape is zero-rated. Settled checkouts get a PDF receipt (pdfkit)
with the seller's tax ID, buyer country / VAT ID, tax rate and the
settlement transaction, linked from the success page, the receipt email
and the customer portal. packages/tax calculateTax is now used at
checkout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coupons now reach checkout. POST /v1/checkout-sessions takes an optional
couponCode, payment links accept ?promo=CODE (a refused code falls back to
full price with a notice), and the hosted checkout gets a promo field
while the session is open and unpaid. The discounted total becomes the
session amount before network bindings, so onchain verification expects
the discounted amount and a locked Zcash quote is re-priced. Codes are
tenant-scoped, product-scoped codes discount only their products, and
free-trial or 100% codes are refused. The redemption is counted once
after the payment confirms (API confirm and hosted checkout).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SettleKit's advertised per-payment fee was never collected because buyers
pay merchants' wallets directly. When PLATFORM_BILLING_ORG_ID is set, the
API now issues each merchant a monthly statement (confirmed payments x the
fee schedule) as an invoice from SettleKit's own org, paid through the
hosted checkout on the G2 payable-invoice path. Totals below the minimum
carry forward, test accounts are skipped, runs are idempotent and happen
automatically every six hours (or via POST /v1/billing/statements/run).
A statement unpaid past due + grace restricts new products to the free
plan limit from packages/pricing (402 with the pay link). Merchants see
accrued fees, statements and a Pay button on the Balances page.
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>
Adds docs/colosseum/SUBMISSION.md (chain matrix with honest labels,
architecture, OSS composed, security model, 1% fee, GTM, traction template
and pre-existing code disclosure with in-window stats against
pre-colosseum-baseline), PITCH-SCRIPT.md, DEMO-SCRIPT.md and
LAUNCH-CHECKLIST.md, and leads the README with the multi-chain product.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- render.yaml deploys the five buyer/seller services on Node 22 with every
env var the new surfaces read (chains, routing, HyperCore, Zcash, x402/MPP,
onchain billing, service token, Discord, fee); Node builds install only the
app and its workspace deps (pnpm --filter <app>...). Free plans everywhere
except the worker (Render has no free background workers: starter).
- API/worker Dockerfiles install filtered; the API runs migrations on boot
because preDeployCommand is paid-only.
- worker boots without GitHub App / Resend / Discord credentials: those
deliveries stay pending and emails are skipped with a warning.
- .env.example documents the service token, manage-link secret and Discord OAuth.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- /docs/integrate: payment link, embeddable button, server-opened sessions
with a return URL, Node webhook signature verification with the event list
and a sample payload, and checking access through the entitlement API.
- api: /v1/entitlements and /v1/entitlements/verify accept the buyer's email
and are scoped to the caller's organization.
- checkout: confirmed buyers are recorded as customers (email, GitHub,
Discord, wallet) so sellers can check access by email; receipts and
subscriptions offer "Continue to <seller>" when the link carried a successUrl.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page posted to a route the API does not have and read fields it does not
return. It now creates /v1/webhooks/endpoints with the chosen events
(default: payment.confirmed, subscription.charged, subscription.canceled,
refund.succeeded) and reveals each endpoint's signing secret for verification.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Subscriptions: every buyer subscription with plan, network and collection
method, status, next charge, last charge (explorer link), dunning state and
cancel at period end / now; active count, MRR and dunning totals. Falls back
to the core list when onchain billing is off.
- Payment detail: Refund payment sends the funds on-chain through
POST /v1/onchain-billing/refunds (operator wallet per network, Base escrow
via the escrow) and shows the refund transaction link; when the operator is
not configured for the network it offers "I refunded manually" to record
the tx hash. Refund rows link to the explorer.
- Refunds ledger links each refund to its payment instead of creating
unsent pending refunds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- checkout: buyers connect Discord (OAuth2 identify + guilds.join) in the
delivery-fields step; the callback saves their user id on the session and
joins them to the product's server. After payment the bot adds the role via
PUT /guilds/{guild}/members/{user}/roles/{role}; the grant is recorded for
access-sync revocation. Without DISCORD_BOT_TOKEN the buyer sees
"pending setup" instead of a fake success.
- worker: discord-delivery-retry grants pending Discord entitlements once the
bot is configured (backoff per entitlement); DISCORD_BOT_TOKEN is optional.
- api: a configured bot delivers roles even before GitHub is set up;
checkout subscriptions pass the buyer's Discord / GitHub ids so subscription
delivery reaches the right accounts.
- dashboard: product settings explain server / role ids and link the bot invite.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recurring checkouts (/c and /l links) offer Subscribe on the session's network:
smart-wallet spend permission, Permit2 capped allowance, Solana SPL delegate or
renewal invoices by email (HyperCore / Zcash). The page states the per-period
price, total cap and expiry before signing; the buyer's wallet (EIP-6963 /
Wallet Standard) sends prerequisite calls and signs the server-built grant,
and the API activates it, charges the first period and delivers access.
Buyers get a signed /s/<token> manage page with status, next charge, charges
with explorer links, cancel and an on-chain revoke. All billing calls go
server-side through /v1/onchain-billing with the service token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- POST /v1/onchain-billing/refunds records the refund tx hash, marks full
refunds, revokes access and emits refund.succeeded; GET /refunds/route tells
the dashboard whether the operator can send the refund on that network
- subscription list/detail read model: next charge, cap, grant expiry,
dunning state, charges with explorer links; cancel mirrors the core
subscription and emits subscription.canceled
- manual refunds emit refund.succeeded; payment detail refunds carry explorer links
- SETTLEKIT_SERVICE_TOKEN + X-SettleKit-Organization lets the hosted checkout
call /v1/onchain-billing server-side for the session's seller (scoped to that prefix)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shared outbox in @settlekit/persistence writes one idempotent webhook_events
row per (org, type, business key) and queues a worker_webhook_jobs delivery per
subscribed endpoint; the worker signs and retries them (capped attempts).
payment.confirmed is emitted from checkout, worker confirmations, API confirms
and agent payments; subscription.charged (+ payment.confirmed) from every
collected onchain period. In-memory API mode delivers in-process.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DEFAULT_FEE_SCHEDULE in packages/platform-billing is the single source of truth;
.env.example documents how the API and web env mirror it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coupons gain an organizationId (column + migration 0010); legacy rows with no
owner stay hidden from every tenant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Payments (GET/confirm/fail/refund), checkout sessions (GET/cancel/expire/
collect-fields) and every other route loading a record by opaque id now
require the record to belong to the authenticated org, answering 404 (never
403) on mismatch so ids in other tenants cannot be probed. Creation paths
that reference another resource (payment->session, checkout->price,
subscription->product/price, refund/dispute->payment, dunning->subscription)
apply the same guard, and escrow tasks are scoped to the caller's org
instead of a client-supplied organizationId.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the confirmed tx is the route provider's destination fill stored on the
session (session.route), the Solana Pay reference, payer and memo bindings
are dropped and the fill is bound by payTo, mint, amount and block time
(>= session creation - 120s), matching the checkout and worker verifiers.
Adds SettlementRequirements.routedFill to carry the flag to verifiers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- @settlekit/hyperliquid createHyperCoreUsdSender: operator-signed usdSend
(EIP-712 via viem), submitted through the HyperCore client; the L1 hash is
read back from the operator ledger (action digest as a labelled fallback).
The API wires it as the HyperCore refund sender when HYPERCORE_ENABLED and
an operator key (HYPERCORE_REFUND_PRIVATE_KEY or the billing operator key)
are set. BillingNetwork is now PaymentNetwork; the renewal-invoice and
access-hook network casts are gone.
- Access hooks call queueDelivery on the first successful charge and when an
expired (suspended) subscription is paid again. API: runs the product's
delivery actions inline through the real handler registry and persists the
run (retryable via /v1/delivery-runs/:id/retry), minting the entitlement
first when needed. Worker: enqueues a pending run on the worker delivery
queue for the delivery-runner job. Both idempotent per charge payment id;
a delivery failure never undoes the charge.
- deliveryActionsFor moved into @settlekit/delivery (zod-free) and shared by
the API agent-payments path and the worker.
- Onchain billing routes use requireOwned / requireOwnedPayment: product
ownership on subscription create, linked core subscription ownership,
foreign customer ids refused on subscription and escrow create.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PgX402NonceStore (x402_nonces, migration 0012): reserve is INSERT ... ON
CONFLICT DO NOTHING on the primary key, so one settle wins across replicas.
The API wires it whenever DATABASE_URL is set; otherwise the facilitator
falls back to the in-memory store and logs a boot warning. One store is
now shared by every per-environment facilitator part.
- allowedPayTo defaults to this deployment's own EVM receiving addresses
(X402_EVM_PAY_TO + X402_PAY_TO_<CHAIN>); an empty allowlist refuses every
recipient, and only X402_FACILITATOR_ALLOWED_PAY_TO=* opens the relayer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>