Spending Intents
Intents are pre-transaction declarations that create an audit trail and enable automatic transaction matching. They answer the question: “What did the agent claim it was going to do?”Terminology note: In LedgerOS, “Intent” refers to a spending intent — a declaration of what your agent plans to purchase. This is different from “intent” in LLM/NLU contexts (user intent classification) or Stripe’s PaymentIntent (a payment lifecycle object).Think of it as: “Before spending, declare your intent.”
Intents work with all card types. When a transaction arrives, it’s automatically matched against pending intents for that card.
Why Intents?
| Without Intents | With Intents |
|---|---|
| Transaction happens, no context | Agent declares intent before spending |
| Hard to audit what agent intended | Clear audit trail of claimed purpose |
| Can’t detect unexpected purchases | Transactions matched against expectations |
Intent Lifecycle
Create an Intent
Before making a purchase, declare what you’re about to do:Intent Fields
| Field | Required | Description |
|---|---|---|
intentId | Yes | Your unique ID (for idempotency) |
summary | Yes | Human-readable description |
expectedAmount | No | Expected amount in cents |
expectedMerchant | No | Expected merchant name |
tolerance | No | Allowed variance in cents (e.g., 500 = ±$5) |
ttlMinutes | No | Time to live (default 30, max 1440) |
metadata | No | Additional context (taskId, orderId, etc.) |
Automatic Matching
When a transaction webhook arrives from the payment network, the system automatically:- Finds any pending intent for the card
- Compares the transaction amount against
expectedAmount(withintolerance) - Compares the merchant name against
expectedMerchant(case-insensitive partial match) - Updates the intent status to
matchedormismatched - Emits a webhook event (
intent.matchedorintent.mismatched)
Transaction Matching
When a transaction arrives, it’s matched against pending intents: Matched - Transaction is within tolerance:List Intents
Best Practices
Always create intent before spending
Always create intent before spending
The intent creates an audit trail. Even if you don’t use matching, it documents what the agent claimed.
Use tolerance for variable amounts
Use tolerance for variable amounts
Tips, taxes, and fees can vary. Set tolerance to account for this:
Include metadata for debugging
Include metadata for debugging
Add context that helps with debugging:
Set appropriate TTL
Set appropriate TTL
Default is 30 minutes. Adjust based on your use case:
- Quick purchases: 10-15 minutes
- Complex checkouts: 30-60 minutes
- Async workflows: up to 1440 (24 hours)
Intent vs Credential Access
Both create audit trails, but serve different purposes:| Intent | Credential Access |
|---|---|
| Declared before any action | Required to get PAN/CVV |
| Optional (but recommended) | Required for card use |
| Matches against transactions | Correlates with transactions |
| Has tolerance for variance | No tolerance, just audit |
- Create intent (declare what you’re about to do)
- Request credentials (get PAN/CVV with attestation)
- Make purchase
- Transaction matched to intent