Skip to content

executeAgentPayment

PQSafe AgentPay API Reference v0.1.0


PQSafe AgentPay API Reference / executeAgentPayment

Function: executeAgentPayment()

executeAgentPayment(signed, request, railConfig?, approvalRequest?): Promise<PaymentResult>

Defined in: pqsafe/agent-pay/src/index.ts:101

Verify a PQ-signed SpendEnvelope and execute the payment if all checks pass.

Checks performed (in order):

  1. ML-DSA-65 signature verification
  2. Zod schema validation
  3. Temporal validity (validFrom / validUntil)
  4. Recipient allowlist check
  5. Amount ceiling check (request.amount <= envelope.maxAmount) 5b. Human approval gate (if approvalRequest provided, or amount >= requiresApprovalAbove)
  6. Route to rail connector

Parameters

signed

SignedEnvelope

request

PaymentRequest

railConfig?

RailConfig

approvalRequest?

ApprovalRequest

Optional approval gate config. If omitted and amount is below any configured threshold, the payment executes immediately. If provided, the payment is blocked until a human approves via the configured channels.

Returns

Promise<PaymentResult>

Throws

if approval is rejected

Throws

if approval times out

Throws

if any other check fails — payments are only attempted if ALL checks pass.