Status: owner-only production runbook. Do not paste Stripe keys or webhook secrets into chat, source code, GitHub issues, screenshots, or ticket systems.
Enable Stripe-hosted card/Link Checkout for reusable PhantomOperator prepaid credits. This is separate from Base-USDC x402 and does not change the live x402 settlement path.
- A Stripe account able to create Checkout Sessions in the intended mode (test or live).
- Owner access to the Stripe Dashboard.
- The production service is healthy at
https://freysaai.freysa.dev/health. - Persistent filesystem access for the SQLite credit ledger.
Run the interactive zero-echo setup script directly on the PhantomOperator host over SSH. If you press Enter at the webhook secret prompt, it automatically creates the webhook endpoint via POST https://api.stripe.com/v1/webhook_endpoints (Stripe-Version: 2026-11-18.endive) for checkout.session.completed and checkout.session.async_payment_succeeded, captures the returned whsec_... signing secret, writes .env with chmod 600, runs node scripts/verify-stripe-credits.js, and restarts phantomoperator.service:
cd /home/nixos/PhantomOperator
./setup-stripe-credits.shOr manually store the following in the protected local .env file (never commit it):
STRIPE_SECRET_KEY=...
STRIPE_WEBHOOK_SECRET=...
ENABLE_STRIPE_CREDITS=true
# optional, if a non-default persistent location is needed:
CREDIT_LEDGER_DB=/secure/persistent/path/credits.sqlite
STRIPE_PROFILE_ID and ENABLE_STRIPE_MPP are not required for ordinary Stripe Checkout credits. Leave MPP disabled unless its separate Stripe Business Network flow is fully tested.
Create one endpoint:
https://freysaai.freysa.dev/billing/stripe/webhook
Subscribe only to:
checkout.session.completed
checkout.session.async_payment_succeeded
Copy the endpoint signing secret into STRIPE_WEBHOOK_SECRET locally. The webhook handler verifies the raw signed request and rejects stale or invalid signatures.
Use Stripe test mode first where available. Do not advertise card payment before every check passes.
- Restart the supervised PhantomOperator user service after local configuration.
- Confirm
POST /billing/stripe/checkoutno longer returns503for a valid whole-cent amount (for example500for $5.00). - Open the returned Stripe-hosted Checkout URL and complete an authorized test payment.
- Confirm Stripe delivered a successful signed webhook.
- Query
GET /billing/credits/balancewith the returned bearer credit token; confirm the expected balance. - Redeem a small authorized audit through
POST /credits/skills/metadata-audit. - Confirm the ledger debited exactly once and the audit result was returned.
- Repeat the same webhook delivery or endpoint retry; confirm fulfillment is idempotent and credits are not doubled.
- Test an execution failure; confirm credit is restored atomically.
- Confirm Base-USDC x402 still returns a normal
402and remains usable.
Only after the above succeeds:
- add card/credit checkout to the human landing page;
- advertise the Website Privacy Baseline offer;
- disclose that credits are bearer tokens and should be stored like an access credential;
- retain Base-USDC x402 as the agent-native payment option.
Set ENABLE_STRIPE_CREDITS=false, restart the user service, and verify:
POST /billing/stripe/checkout → 503
POST /billing/stripe/webhook → 404
Existing credit balances remain durable in the ledger; disabling the rail must not delete records or expose tokens.