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.
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
| Endpoint | Scope | What it does |
|---|---|---|
| POST /v1/request-payment | agent + HMAC | Policy-checked payment with atomic reservation |
| POST /v1/approvals/{id}/resolve | approver | Approve or reject a pending approval (single-use claim) |
| POST /v1/requests/{id}/reconcile | operator | Settle or release an ambiguous provider outcome |
| GET/POST /v1/sessions | agent/operator | Budget sessions: create, inspect, abort |
| GET /v1/analytics/* | scoped | Summary, transactions, CSV export (masked) |
| /demo/v1/* | anonymous visitor | The Playground API - mock provider only |
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.
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.