All starter kits

Payment & Settlement

Mandate-gated procurement with a finance-ready receipt

Your ops team approves a budget line, someone manually sources vendors, another person confirms the purchase, and finance manually reconciles the receipt. Replace all three steps with a single mandate-gated Patchr call: Hunt for the best option, Resolve against policy, Pay inside the spend ceiling.

Agent route

HuntResolvePay→ proof card
Before Patchr

Manual process, no audit trail, inconsistent outcomes.

// Before: manual sourcing + receipt email chain
async function procure(lineItem) {
  // ❌ Sourcing: someone manually checks vendor portals
  // ❌ Approval: email thread with procurement manager
  // ❌ Payment: manual transfer; receipt stored in inbox
  const vendors = await manualVendorSearch(lineItem.category);
  await sendApprovalEmail(vendors, lineItem.budget);
  // ...wait for email reply...
  await manualPayment(selectedVendor, lineItem.amount);
}
After Patchr — Node.js

One SDK call. Evidence map, proof card, and recommended action returned.

import { PatchrClient } from "@patchr-core/sdk";

const patchr = PatchrClient.fromEnv();

async function procure(lineItem) {
  const run = await patchr.runOrchestrator({
    clientId:       "finance-ops",
    channel:        "api",
    conversationId: `conv_proc_${lineItem.id}`,
    request: `Source and procure ${lineItem.description}.
Budget: $${lineItem.budget}. Preferred vendors: ${lineItem.vendors.join(", ")}.
Resolve against our vendor policy and settle with receipt.`,
    metadata: {
      spendCeiling: lineItem.budget,
      currency:     lineItem.currency || "USD",
      policyRules:  lineItem.policyRules,
    },
  });

  // ✅ Hunt found best-fit vendor within mandate ceiling
  // ✅ Resolve confirmed no policy contradictions
  // ✅ Pay settled — finance-ready receipt attached
  if (run.status === "settled") {
    return {
      receipt:  run.receipt,
      proofCard: run.proofCard,
    };
  }
  // Handle NEEDS_INPUT (result selection) if live network search returns options
  return { status: run.status, paths: run.decisionTree?.paths };
}
After Patchr — Python

Same integration using the raw HTTP API with the httpx client.

import os, httpx

PATCHR_API   = os.environ["PATCHR_API_BASE_URL"]
PATCHR_TOKEN = os.environ["PATCHR_API_TOKEN"]

def procure(line_item):
    resp = httpx.post(
        f"{PATCHR_API}/v1/orchestrator/run",
        headers={"Authorization": f"Bearer {PATCHR_TOKEN}"},
        json={
            "clientId":       "finance-ops",
            "channel":        "api",
            "conversationId": f"conv_proc_{line_item['id']}",
            "request": (
                f"Source and procure {line_item['description']}. "
                f"Budget: ${line_item['budget']}. "
                f"Preferred vendors: {', '.join(line_item['vendors'])}. "
                "Resolve against our vendor policy and settle with receipt."
            ),
            "metadata": {
                "spendCeiling": line_item["budget"],
                "currency":     line_item.get("currency", "USD"),
                "policyRules":  line_item["policyRules"],
            },
        },
    )
    run = resp.json()

    if run.get("status") == "settled":
        return {
            "receipt":   run.get("receipt"),
            "proofCard": run.get("proofCard"),
        }
    return {"status": run.get("status"), "paths": run.get("decisionTree", {}).get("paths")}

Output shape

A consistent proof card — every run.

Whether you run a dispute audit or an agent governance check, the output shape is identical. External systems — dashboards, decision ledgers, compliance tools — consume the same format regardless of which workflow produced it.

evidenceStatus — sourceBound | verified | partial

confidence — 0–1 score from the evidence map

recommendedRestraint — proceedSafely | proceedWithCaution | escalateBeforeActing

cite — portable proof ref for cross-system ledgers

Proof card format

Sample output

{
  "status": "settled",
  "route": ["hunt", "resolve", "pay"],
  "receipt": {
    "receiptId": "rcpt_...",
    "status":    "settled",
    "amount":    { "amount": 6840, "currency": "USD" }
  },
  "proofCard": {
    "title":                "Procurement: Q3 cloud storage expansion",
    "evidenceStatus":       "sourceBound",
    "confidence":           0.94,
    "recommendedRestraint": "proceedSafely",
    "cite":                 "patchr:proofCard:card_...#v1"
  }
}

Ready to run it?

Source and procure Q3 cloud storage expansion for the Lagos data centre. Budget: $8,000. Preferred vendors: AWS, GCP. Resolve against our vendor policy and settle with receipt.

Open in sandbox