Field-tested practices for running SohoPay in production: how to call the API resiliently, how to manage agent keys, and what to have in place before mainnet. Everything here is a checklist, not abstract advice.

API integration

  • Retry with exponential backoff. Retry 429 (honoring Retry-After) and 5xx; never retry 4xx other than 429 — those need a code or data fix, not a retry. The official SDKs do this by default.
  • Always send an Idempotency-Key. Every POST should carry one, reused across retries of the same logical operation. Without it, a timed-out-then-retried payment can settle twice. The SDKs generate one per request automatically.
  • Implement a circuit breaker. If error rate on a route exceeds a threshold (say 50% over 30s), stop calling for a cool-off window instead of hammering a degraded endpoint. This keeps you inside rate limits during incidents and speeds your own recovery.
  • Log settlement_tx and request_id on every transaction. The transaction hash proves settlement on-chain; the request ID lets support trace any API call in minutes. Log both at the point of the call, structured, and keep them queryable.
  • Alert on error rate, not single errors. Page on sustained INSUFFICIENT_CREDIT (collateral running low), any AML_DECLINED (needs human review), rising 429s (approaching limits), and webhook delivery gaps (your receiver may be down).

Agent key management

Agent keys live inside SohoPay’s MPC infrastructure, so you never hold raw private keys — but rotation, monitoring, and access control are still yours to run. See Key Management for the mechanics.
  • Rotate on a fixed cadence. Quarterly for high-volume agents, at least annually for the rest — and immediately on any suspected compromise or when a team member with rotation access leaves.
  • Pause before you rotate. Pause the agent, drain in-flight payments, rotate, verify a test payment, then resume. Rotating a live agent mid-payment can fail the in-flight signature.
  • Monitor agent.key_rotated webhooks. Every rotation emits one. Alert on any rotation your team didn’t schedule — an unexpected event is your earliest compromise signal.
  • Restrict who can rotate and revoke. Treat rotation and revocation like production deploy rights: named individuals, dashboard roles enforced, and every rotation recorded in your change log with who and why.
  • Also rotate your API keys and webhook secrets. Same cadence, same access control. Overlap old and new keys briefly during rollout so nothing 401s mid-deploy.

Production readiness

1

Finish the sandbox checklist

Before requesting mainnet access, your sandbox integration should have exercised every path you’ll run in production:
  • Full flow passes: create agent → create order → submit payment → payment.settled webhook received and verified
  • Error paths tested: INSUFFICIENT_CREDIT, ORDER_EXPIRED, AGENT_NOT_ALLOWLISTED, RATE_LIMITED, and the AML decline test wallet (see Testing)
  • Webhook receiver verifies signatures, dedupes by event_id, and returns 2xx in under a second
  • Idempotency verified: replaying a POST with the same key returns the original result
  • Agent revocation and key rotation rehearsed end to end
2

Complete mainnet onboarding

Mainnet is in private beta — join the waitlist via the dashboard. Onboarding steps:
  • Merchants: pass KYB (1–3 business days, Didit-powered)
  • Operators: deposit real USDC collateral into the vault and set conservative initial credit_limit / daily_limit
  • Create sk_live_ keys, store them in a secrets manager, and confirm your base URL switches to https://api.sohopay.xyz/v1
  • Register production webhook endpoints and fire a test delivery
  • Review operator liability — you are liable for your agents’ transactions
3

Set up monitoring

Wire your observability stack (Datadog, Grafana, or equivalent) before the first live payment:
  • Dashboards: payment success rate, settlement latency (normal is ~1s), error rate by code, webhook delivery lag
  • Alerts: the error-rate alerts from the API section above, plus vault collateral below a threshold and available_credit trending to zero
  • Watch the Observatory and platform /status for SohoPay-side incidents, and Wallet Usage for per-agent spend anomalies
4

Write the incident runbook

The one incident to pre-plan is a Policy Service outage. SohoPay is fail-closed: if the Policy Service is down, no settlements happen — payments queue and settle automatically on recovery. Your runbook:
  • Confirm the incident on /status and the Observatory before assuming it’s your bug
  • Do not resubmit queued payments — idempotency protects you, but resubmission adds noise and load
  • Pause agent activity that is time-sensitive (orders expire after 10 minutes; agents should recreate orders after recovery rather than retry stale ones)
  • Communicate expected behavior to your own users: payments are delayed, not lost
  • After recovery, reconcile: every queued payment should show settled or a terminal failure — investigate anything else with support
5

Run post-incident reviews

After any incident — yours or SohoPay’s — write a short review within a week: timeline, impact (payments delayed/failed, with request_ids), what your alerts caught and missed, and one concrete follow-up. Share SohoPay-side findings with support; it feeds the SLA process.
A sohopay CLI for scripting these checks is on the roadmap but not yet shipped. Until then, script against the SDKs or the raw API.

Next steps

Error Handling Guide

Retry and recovery patterns with full code.

Key Management

Rotation mechanics and MPC key architecture.

Troubleshooting

Symptom-by-symptom fixes when something breaks anyway.