Use this when running or automating PayRam headless (CLI-only, no web UI). Only this repo may be modified; payram-core, payram-frontend, etc. are read-only.
- PayRam must be running (e.g.
./setup_payram_agents.sh-> follow prompts). - Default API:
http://localhost:8080. For local, frontend URL ishttp://localhost(port 80). - Docker required if
PAYRAM_NODE_MODE=docker(default) for JS tooling.
Run from repo root: ./setup_payram_agents.sh [command]
Entrypoint modes:
- One-step flow (install + headless):
./setup_payram_agents.sh(prompts for network, then runs setup/signin/config/wallet/payment)
- Headless-only commands:
./setup_payram_agents.sh status|setup|signin|ensure-config|ensure-wallet|deploy-scw|deploy-scw-flow|create-payment-link|reset-local|menu|run
| Command | Purpose |
|---|---|
(none) or menu |
Show step menu; pick one step to run |
status |
Check API reachable and auth (token saved / valid) |
setup |
First-time: register root user + create default project |
signin |
Sign in; saves token to .payraminfo/headless-tokens.env |
ensure-config |
Seed payram.frontend and payram.backend for local API (needed for payment creation) |
ensure-wallet |
Create random BTC wallet or link existing to project (for payment links) |
deploy-scw |
Deploy ETH/EVM smart-contract deposit wallet; then auto-link to project |
deploy-scw-flow |
Generate mnemonic -> fund deployer -> balance check -> deploy SCW |
create-payment-link [projectId] [email] [amountUSD] |
Create payment link; outputs single URL to open |
run |
Full flow: setup/signin → ensure-config/ensure-wallet → create payment link (prompts) |
reset-local [-y] |
Wipe local DB and API data; then run ./setup_payram_agents.sh again |
Set these for non-interactive or scripted runs. For agents, prefer env-driven, non-interactive usage.
| Variable | Default | Notes |
|---|---|---|
PAYRAM_API_URL |
http://localhost:8080 |
Backend API base |
PAYRAM_EMAIL |
— | Root user email (setup/signin) |
PAYRAM_PASSWORD |
— | Root user password |
PAYRAM_PROJECT_NAME |
Default Project |
Project name on setup |
PAYRAM_PAYMENT_EMAIL |
— | Customer email for payment link |
PAYRAM_PAYMENT_AMOUNT |
10 |
Amount in USD for payment link |
PAYRAM_CUSTOMER_ID |
from signin | Usually from token file after signin |
PAYRAM_FRONTEND_URL |
http://localhost |
Used by ensure-config (local) |
PAYRAM_NETWORK |
testnet |
One-step flow network selection (testnet or mainnet) |
PAYRAM_NODE_MODE |
docker |
JS runtime: docker or host |
PAYRAM_NODE_DOCKER_IMAGE |
node:20-bullseye-slim |
Docker image used for JS scripts |
| deploy-scw | ||
PAYRAM_ETH_RPC_URL |
https://ethereum-sepolia-rpc.publicnode.com |
No API key needed. Placeholder values (e.g. YOUR_ACTUAL_ALCHEMY_KEY) are ignored and default used. |
PAYRAM_FUND_COLLECTOR |
deployer address | Cold wallet 0x (40 hex). Omit or leave empty to use deployer address from mnemonic. |
PAYRAM_SCW_NAME |
Headless SCW |
Name for the SCW wallet |
PAYRAM_BLOCKCHAIN_CODE |
ETH |
e.g. ETH, BASE, POLYGON |
PAYRAM_MNEMONIC |
— | Or mnemonic in .payraminfo/headless-wallet-secret.txt |
PAYRAM_SCW_MIN_BALANCE_ETH |
0.01 (testnet) |
Balance threshold before deploying SCW |
PAYRAM_SCW_SKIP_BALANCE_CHECK |
— | If set, skip balance polling (not recommended) |
PAYRAM_WALLET_CHOICE |
— | 1 create, 2 link, 3 skip (non-interactive) |
PAYRAM_WALLET_QUIET |
— | If set, suppress wallet prompt text |
Token is read from .payraminfo/headless-tokens.env (created by signin). Deploy-scw uses mnemonic from that file or PAYRAM_MNEMONIC.
Non-interactive defaults:
- One-step flow defaults to
deploy-scwfor wallet creation. - If
PAYRAM_WALLET_CHOICEis set, prompts are suppressed and that choice is used. - If running in non-interactive mode (no TTY), the script will use defaults and continue without prompts.
- Start PayRam:
./setup_payram_agents.sh(installs or restarts). - Auth:
./setup_payram_agents.sh signin(or setup if first time). Env:PAYRAM_EMAIL,PAYRAM_PASSWORD. - Config (local):
./setup_payram_agents.sh ensure-configso payment creation works. - Wallet: Either
./setup_payram_agents.sh ensure-wallet(BTC) or./setup_payram_agents.sh deploy-scw-flow(ETH SCW). deploy-scw-flow generates a mnemonic, shows deployer address, waits for funds, then deploys. - Payment link:
./setup_payram_agents.sh create-payment-linkor pass[projectId] [email] [amountUSD]. Use the printed URL as-is (keep&host=...).
The one-step flow does:
- Network selection (
testnetormainnet) unlessPAYRAM_NETWORKis set. - Install or restart PayRam using
setup_payram.sh. - Waits for API readiness (
/api/v1/member/root/exist). - Auth (
setupif no root user, elsesignin). ensure-configfor local frontend/backend settings.- Wallet flow:
- Default:
deploy-scw-flow(ETH SCW). - Optional:
ensure-wallet(BTC).
- Default:
- Optional payment link creation.
deploy-scw-flow does:
- Generate mnemonic if
.payraminfo/headless-wallet-secret.txtis missing. - Derive deployer address from the mnemonic and show it.
- Wait for balance >=
PAYRAM_SCW_MIN_BALANCE_ETHby polling the RPC. - Deploy SCW using
scripts/deploy-scw-eth.js. - Register SCW with backend and link to the project.
Funding step:
- You must send ETH to the deployer address manually (testnet faucet for Sepolia, or mainnet wallet).
- The script waits until the balance meets the threshold, then proceeds.
- When
PAYRAM_NODE_MODE=docker, JS scripts run inside Docker. - The script maps
PAYRAM_API_URLfromlocalhosttohost.docker.internalso the container can reach the host API. .payraminfois mounted into the container to access the mnemonic and tokens.
- Use the exact URL printed (one block: “Open this in your browser”). Do not strip
hostor change&. - If the payment page loads forever or shows
undefinedin API calls: the link must includereference_idandhostwith a real&. Fix any\u0026→&if the link was mangled.
- RPC: Default PublicNode Sepolia (no key). Override with
PAYRAM_ETH_RPC_URLif needed. - Fund collector: Optional. Omit or press Enter to use deployer address (sweep to self). Set
PAYRAM_FUND_COLLECTORto a valid 0x address for a different cold wallet. - Gas: Deployer address (from mnemonic) must have Sepolia ETH. If you see
INSUFFICIENT_FUNDS, send testnet ETH to the deployer address shown in the log; use e.g. https://sepoliafaucet.com or https://www.alchemy.com/faucets/ethereum-sepolia. - After success, the script registers the SCW and links it to the current project; no extra step.
./setup_payram_agents.sh reset-local [-y]clears DB and API data (and optionally Docker image).- Then run
./setup_payram_agents.shagain.
- Token / secrets:
.payraminfo/headless-tokens.env,.payraminfo/headless-wallet-secret.txt(mnemonic). Do not commit. - Scripts:
scripts/generate-deposit-wallet.js(BTC),scripts/generate-deposit-wallet-eth.js(ETH xpub),scripts/deploy-scw-eth.js(SCW deploy). Run via headless commands; deploy-scw is invoked by./setup_payram_agents.sh deploy-scw.
- Always set
PAYRAM_EMAIL,PAYRAM_PASSWORD, andPAYRAM_CUSTOMER_IDfor fully non-interactive runs. - Use
PAYRAM_WALLET_CHOICE=1andPAYRAM_WALLET_QUIET=1to avoid wallet prompts. - For SCW, set
PAYRAM_SCW_MIN_BALANCE_ETHto a known safe threshold if your RPC has delayed balance reporting. - When using Docker node runtime, ensure Docker is running and has access to host networking.
| Issue | Action |
|---|---|
| API unreachable | Ensure PayRam is running (./setup_payram_agents.sh). Check PAYRAM_API_URL. |
| Auth expired / 401 | Run ./setup_payram_agents.sh signin again. |
| Payment creation 500 | Run ensure-config and ensure-wallet (or deploy-scw). Check backend logs: docker logs payram 2>&1 | tail -80. |
| deploy-scw 401 on RPC | Do not use placeholder RPC URL; default (PublicNode) is used if env looks like a placeholder. |
| deploy-scw INSUFFICIENT_FUNDS | Send Sepolia ETH to the deployer address (from mnemonic) shown in the log. |
| Payment page loads forever | Use the payment URL exactly as returned; ensure host param and & are correct. |