Mock sandbox - no real money

Quick start (local)

git clone https://github.com/dedalik/agentpaysdk.git
cd sanestlypay
make demo        # starts gateway + playground at http://127.0.0.1:8080/sanestlypay/demo

The same Playground you see here runs against your local SQLite database. No credentials needed - the mock provider is deterministic.

Payment lifecycle

request -> policy evaluation -> [ALLOW | DENY | REQUIRES_APPROVAL]
  ALLOW              -> reservation -> provider -> settled / released
  REQUIRES_APPROVAL  -> single-use approval claim -> approve -> provider -> settled
                     -> reject  -> reservation released
  ambiguous provider -> 202 reconciliation_required -> /reconcile settles or releases

API surface

EndpointScopeWhat it does
POST /v1/request-paymentagent + HMACPolicy-checked payment with atomic reservation
POST /v1/approvals/{id}/resolveapproverApprove or reject a pending approval (single-use claim)
POST /v1/requests/{id}/reconcileoperatorSettle or release an ambiguous provider outcome
GET/POST /v1/sessionsagent/operatorBudget sessions: create, inspect, abort
GET /v1/analytics/*scopedSummary, transactions, CSV export (masked)
/demo/v1/*anonymous visitorThe Playground API - mock provider only

Authentication

Two layers: X-API-Key identifies the principal (agent / approver / operator, scoped in config.yaml), and X-Signature proves integrity of the request body.

signature = hex(HMAC_SHA256(
    secret,
    METHOD + "\n" + PATH + "\n" + IDEMPOTENCY_KEY + "\n" + TIMESTAMP + "\n" + BODY
))

Timestamps must be within a 300s window. Idempotency keys are bound to principal + path + body hash.

Honesty contract

Providers are labelled mock, implemented, sandbox_verified, production_verified or requires_provider_access. Unconfigured providers raise ProviderNotConfigured - the gateway never mints fake cards or tokens. Card creation is never treated as payment settlement.