HTTP status & error map
Every error response follows a standard JSON envelope:Idempotency keys: prevent duplicate payments
EveryPOST request accepts an Idempotency-Key header. If a network timeout occurs and you resubmit with the same key, SohoPay returns the original processed result rather than executing a duplicate charge.
Exponential backoff with jitter
When handling429 (rate limit) or 500 (service transient) errors, implement exponential backoff with full jitter to avoid stampeding retry storms:
Key error recovery playbooks
1. INSUFFICIENT_CREDIT (402)
- Root cause: The payment amount plus 5% fee exceeds the agent’s available credit or daily limit.
- Recovery: Raise the agent’s limits via
PATCH /api/v1/agents/{id}or deposit additional collateral via Vault & Funding. If you are a borrower, repay outstanding debt in the Borrower Portal. Retrying without limit expansion will fail identically.
2. AGENT_PAUSED (403)
- Root cause: The agent operator has frozen agent activity.
- Recovery: Unpause the agent via
POST /api/v1/agents/{id}/resumeor toggle it active in the Borrower Portal.
3. AML_DECLINED (402)
- Root cause: Real-time sanctions or AML screening flagged counterparty risk.
- Recovery: Do not retry programmatically. Rapid retries resemble transaction structuring. Route the incident to human compliance review.
4. ORDER_EXPIRED (400)
- Root cause: The 10-minute order window elapsed.
- Recovery: Call
POST /api/v1/ordersto generate a fresh order ID. Do not resubmit payment against the stale order.
Circuit breakers & observability
When upstream policy infrastructure experiences sustained disruption, the system fails closed. Implement a local circuit breaker:- If 5 consecutive payment attempts fail with
500, trip the circuit open. - Queue pending payments locally and probe every 30 seconds.
- Log both
request_idandsettlement_txacross all application traces for fast triage with SohoPay support.
Next steps
Testing Guide
Simulate magic error codes and test recovery in the sandbox.
Payment Flow
Review the complete order and settlement sequence.
Webhooks Guide
Handle asynchronous payment confirmations reliably.

