SERVER / STRIPE & CUSTOS

Paid checkout.
Controlled provisioning.

Authenticate Stripe’s exact bytes, bind the paid session to its buyer’s public holder key, and commit one signed CUSTOS lease with durable deduplication.

USD 1.00 one-time sandbox tier configured

The approved issuer public key, lease policy, and test Stripe Price are configured. The signer checks that the environment-only seed matches the issuer pin. Live Stripe credentials and live events are refused. The issuer must also be enrolled in the engine’s trust file; storefront configuration alone cannot enroll it.

Webhook route

SERVER ENDPOINT
POST /api/stripe/webhook\nStripe-Signature: [Stripe-signed header]

Raw-body parsing runs before JSON parsing. Invalid signatures return 400. A paid checkout.session.completed is retrieved from Stripe, checked for product, price, quantity, and buyer linkage, then provisioned. Failures before commit return 503 for retry.

Environment-only signing

ENVIRONMENT VARIABLE NAMES · NO VALUES
CUSTOS_ISSUER_SEED               # Server-only 32-byte seed as hex
STRIPE_WEBHOOK_SECRET            # Server-only Stripe webhook secret
STRIPE_SECRET_KEY                # Server-only Stripe API credential
CUSTOS_TRUSTED_ISSUER_PUBLIC_KEY  # Optional override of public issuer pin
CUSTOS_LEASE_POLICY              # Optional override of public grant policy
STRIPE_PRICE_ID                  # Optional override of approved test Price
APP_ORIGIN                      # Actual public browser origin

There are no hardcoded private keys or fallback seeds. Scopes, maximum amount, swarm, and logical TTL are operator-approved policy—not buyer-controlled fields. Public defaults live in server/tier-config.ts; the actual Preview origin is allowed for sandbox testing. Set APP_ORIGIN to the deployed public origin when publishing.

The issued lease

CLOSED CUSTOS LEASE SCHEMA
lease_id       16 random bytes, lowercase hex
issuer         trusted issuer's 32-byte public key, hex
holder         buyer-provided 32-byte public key, hex
swarm_id       approved swarm identifier
scopes         sorted unique approved scopes
max_amount     canonical u128 decimal string
lamport_issued current pinned clearance head clock
ttl            1–100000 Lamport ticks (not seconds)
sig            Ed25519 signature, lowercase hex

Signing input is ARKHEIA/custos/lease/v1, a zero byte, and JCS of the lease without sig. The engine’s own signing key is not a CUSTOS issuer.

One stored lease per checkout

A transaction inserts the unique event ID and locks the checkout row. Signing and fulfillment commit together. Event redelivery and distinct events for an already fulfilled session reuse the committed entitlement rather than minting another stored lease.

Delivery and operations

The purchase page requires the secure buyer cookie; a public session ID alone grants no access. It shows pending until the webhook commits, then offers a lease download. Access is browser-bound for 30 days; cross-device recovery is not implemented.

Only immediate, one-time card payments are offered. Refund-driven revocation, recurring renewal, and delayed payment fulfillment require separate lifecycle handling.

Download deployment instructions

Claim the Stripe sandbox in Settings → Integrations. Configure live credentials there and republish before accepting real payments. No payment or live mandate approval was performed during this build.

Public API contract observed November 28, 2026.View source