19 Commits

Author SHA1 Message Date
29de477e0f feat: Spanish hosted checkout via packages/localization (G14, part 2)
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>
2026-09-30 06:42:02 +03:00
1d92fa23f2 feat: branded hosted storefront per merchant (G12)
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>
2026-09-30 06:32:06 +03:00
f1647a5a81 feat: embeddable checkout overlay (embed.js) with allow-listed success callback (G6, part 1)
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>
2026-09-30 04:52:19 +03:00
a4d0f3f5cb feat: tax at checkout and tax-grade receipts (G4)
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>
2026-09-30 04:30:53 +03:00
4e97fcc409 feat: promo codes at checkout (G3)
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>
2026-09-30 04:09:54 +03:00
61ce1686ff feat(web): SaaS integration guide at /docs/integrate, with email-based entitlement checks
- /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>
2026-09-29 21:39:36 +03:00
bcccfb0bf7 feat(discord): real paid-role delivery with Connect Discord at checkout
- 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>
2026-09-29 21:31:32 +03:00
ae448fe158 feat(checkout): subscribe to recurring products with onchain billing
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>
2026-09-29 21:24:52 +03:00
19fa1aa9cb feat(checkout): reusable payment links and seller-hosted delivery links
/l/<slug> shows the product and opens a fresh checkout session per visit
(client-side, so link unfurlers never create sessions). File and plain
access products reveal the seller's https link after payment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 20:37:41 +03:00
ae216e213b fix(checkout): require a wallet signature to bind the EVM payer
The evm/payer route bound any address without proof, so anyone holding the
session URL could lock the buyer out. The buyer's wallet now personal_signs
a short-lived message naming the session, network and payer; the server
verifies it with viem (ECDSA locally, EIP-1271/6492 through the chain RPC
for smart wallets). Unsigned requests never bind or rebind a payer; a new
valid signature may rebind so the real buyer can always recover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 19:59:00 +03:00
a1078a0082 perf(checkout): split per-network payment flows into client chunks; document routing and HyperCore env
next/dynamic now runs in a client module (components/LazyPay), so EvmPay,
SolanaPay, ZcashPay, HyperCorePay, AnyTokenPay and the Arc demo wallet load
on demand: /c/[sessionId] first load drops from 230 kB to 176 kB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 19:15:47 +03:00
11c91fd1b2 feat(checkout): pay with any token, HyperCore usdSend and Tempo memo enforcement
Any token (replaces the BridgePay/LocalAppKitSdk simulation, now deleted):
- lib/any-token.ts: Relay/LI.FI router from ROUTING_* env, per-session
  destination (the token the verifier checks), policy-checked EXACT_OUTPUT
  quotes stored as session.route, status polling that settles ONLY through
  recordAndConfirm on the destination fill (routed fills skip the payer and
  memo bindings, never payTo/amount/token/time); provider success without a
  qualifying transfer is reported as unverified and stays unpaid
- routes [sessionId]/route/{quote,status} with the same-origin guard
- AnyTokenPay: origin chain + token picker, fees and quote TTL, EIP-6963
  execution of the provider's transactions, deposit-address QR fallback,
  progress, refund notice
- network changes are locked while a route moves funds; a payment confirmed
  by the worker now completes and fulfils the session on the next confirm

HyperCore: runtime (HYPERCORE_*), usdSend params/submit/status routes,
HyperCorePay (wallet signs usdSend, manual hash fallback), verify-payment
case, network options, explorer links.

Tempo: evm params expose memoRequired; sessions with requireMemo only settle
with transferWithMemo(keccak256(sessionId)).

Per-network payment components are lazy-loaded; the Arc demo wallet is
labelled as a simulation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 18:20:35 +03:00
5d0294e693 fix(checkout): keep the network picker when the current network is unavailable
A session whose own network is not verifiable here but has one other
available network would otherwise leave the buyer with no way to pay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 17:19:33 +03:00
dd2d63e48b feat(checkout): network picker, EVM wallet pay and Zcash pay UI
- NetworkPicker: accepted + verifiable networks grouped Solana / EVM
  chains / Zcash, native radios, asset and honest badges (testnet,
  bridged, transparent)
- EvmPay: EIP-6963 discovery (window.ethereum fallback), payer binding,
  wallet_switchEthereumChain with 4902 -> wallet_addEthereumChain from
  the registry, viem writeContract transfer (TIP-20 transferWithMemo with
  the session memo on Tempo), confirmation polling, explorer link;
  EIP-681 QR + manual transaction-hash fallback
- ZcashPay: ZIP-321 QR (uqr), copy address and exact amount, quote
  countdown and re-quote, 20 s status polling, paste-txid fallback,
  transparent-payment note, late payments shown as under review
- page routes SolanaPay | EvmPay | ZcashPay; Arc demo wallet/bridge cards
  only on Arc; receipt shows the settled asset
- next.config transpiles @settlekit/chains and @settlekit/zcash
- tests for discovery, chain switching, transfer encoding, labels,
  grouping, countdown and ZIP-321 display

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 17:12:13 +03:00
e8ec94cf9c feat: Solana Pay checkout routes and wallet UI
- POST solana/pay-url saves buyer fields, returns transfer-request QR
  payload + transaction-request link bound to the session reference
- GET/POST solana/tx: Solana Pay transaction request; server builds the
  unsigned USDC tx (ATA create-idempotent + TransferChecked + reference)
- GET solana/status: finds the payment by reference, verifies, confirms
  and delivers once (idempotent, safe to poll)
- SolanaPay component: uqr QR, Wallet Standard connect +
  solana:signAndSendTransaction, 2s polling, paid state with Solscan link
- checkout page renders SolanaPay for Solana sessions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 14:59:16 +03:00
c33eed8d4b feat: fail-closed checkout confirmation with real GitHub delivery
- recordAndConfirm verifies every network on-chain (Solana via
  @settlekit/solana, Arc via @settlekit/arc) and fails closed when a
  network has no configured verifier; Solana requires the session
  reference
- network-aware tx hash validation on the confirm route and form
- duplicate tx hash (lookup or unique violation) -> 409 conflict
- confirmFromReference finds Solana Pay payments by reference, idempotent
- fulfillment runs once per confirmed payment: entitlement row via
  @settlekit/entitlements plus a real GitHub App invite
  (grantGitHubRepoAccess); missing GitHub App env shows pending setup,
  never a fabricated invite link
- receipts carry explorer links (Solscan for Solana)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 14:59:08 +03:00
874fa3a08a feat(apps): Phase 7 — escrow lifecycle, portal P2P send, checkout crosschain bridge
- dashboard: escrow detail lifecycle actions (assign/fund/submit/approve/refund) via server actions + api.escrow.* client methods.
- portal: P2P 'send USDC on Arc' page + nav (offline App Kit send, live swap documented); +@settlekit/app-kit dep.
- checkout: 'pay from another chain' crosschain bridge option (App Kit bridge, offline) next to wallet-pay.
- Built inline (subagent limit hit). Phase 7 complete. 1308 tests / 213 suites, typecheck + builds green.
2026-06-21 17:44:20 +03:00
ab81e9c8b7 feat(checkout): wallet-pay via Circle App Kit (real @circle-fin/app-kit + offline default)
- apps/checkout: 'Pay with wallet' option — server action + WalletPay component over @settlekit/app-kit; offline LocalAppKitSdk default, real @circle-fin/app-kit@^1.7.0 on the live path (WALLET_PAY_LIVE, dynamic import so it only bundles when enabled).
- Add @circle-fin/app-kit dep; allowBuilds bufferutil/utf-8-validate=false.
- creator-dashboard: data.ts proof helpers (detectGroundingForText/proveGroundingForText) for the attribution UI.
- 1308 tests / 213 suites, typecheck + builds green; frozen-lockfile verified.
2026-06-21 11:44:49 +03:00
598cd03f05 feat: implement all 8 SettleKit apps + fix x402 nonce round-trip
apps:
- api: Hono REST server, all §26 endpoints, 14 tests
- worker: delivery runner + payment-confirm + access-sync + renewal + webhook-retry jobs wired to real package clients
- dashboard: Next.js merchant dashboard, full §16/§27 sections + §28 product builder
- checkout: Next.js hosted USDC checkout with real delivery materialization
- marketplace: Next.js public marketplace + agent metadata.json route
- admin: Next.js risk/ops console wired to @settlekit/risk + database
- docs: Next.js docs site (9 static routes)
- examples: 5 runnable end-to-end examples

fix(x402): support pinned config.nonce so a stateless verifier can confirm
the challenge nonce round-trips (default stays random; package tests intact).

Full workspace: 590 tests passing (122 files), tsc green for all packages +
api/worker/examples, all 5 Next apps typecheck clean, docs next build green.
2026-06-15 10:49:14 +03:00