Skip to main content
All use cases
Treasury / CardOperations

A card bound to the mandate, with every attempt checked.

For the ad-hoc purchases that end up on someone's personal card. codespar_issue issues the card through Pomelo; the Pomelo connection points at Pomelo's staging host. On every charge attempt Pomelo calls CodeSpar's authorizer, which checks the agent's signed mandate: expiry, currency, per-transaction cap, total cap and allowed merchants. In observe mode the authorizer records its decision and answers approved, so a charge the mandate would refuse still clears and is recorded as an exception. In enforce mode the decision is the answer.

BeforeA shared corporate card, reviewed weeks later
AfterA card per mandate, every attempt decided and recorded
5
checks on every charge attempt
Try it in the Sandbox
Pomelo
Issuer
codespar_issue issues and controls the card; the connection points at Pomelo's staging host
5
Checks per attempt
Expiry, currency, per-transaction cap, total cap, allowed merchants
observe · enforce
Two modes
Observe records the decision and approves; enforce makes it binding
≠
Divergence recorded
In observe, a charge the mandate would refuse clears and is recorded as an exception
Illustrative example · demo data

One attempt, one recorded decision.

An example with demo data: the agent renews a subscription with its card. Pomelo asks the authorizer, which checks the mandate and records its decision. In observe mode the issuer is told approved whatever the decision; in enforce mode a refusal declines the charge.

  • The issuer calls the authorizer on every attempt; the agent does not
  • The decision checks the mandate: expiry, currency, caps, allowed merchants
  • Observe mode approves and records; only enforce mode declines

Renew the analytics subscription with the ops card.

Charging USD 340.00 to SubscriptionCo with the card bound to the ops mandate.

Card authorization attempt · example
auth_demo · SubscriptionCo
Decision recorded · example
MerchantSubscriptionCo · MCC 5817
AmountUSD 340.00
Mandatemnd_demo · USD 2000.00
Decisionwithin_mandate
Answer to the issuerAPPROVED
authorization-trace.json
✓ decision recorded · exampleauth_demo
The pain

The conversation is the easy part.

Governance on a corporate card today is a shared number, a list of who may use it and a statement reviewed weeks later. An agent buying ad hoc makes that worse: nobody sees a bad charge before it clears.

One shared card number for whoever needs to buy

A card bound to the agent's own signed mandate

Approvals after the statement arrives

Every attempt is decided against the mandate as it happens

No record of why a charge was allowed

Each decision is recorded with its reason

Freezing a card means a call to the bank

codespar_issue freezes, unfreezes or cancels the card at the issuer

How the agent does it

A mandate on the card, a decision on every attempt.

codespar_issue issues and controls the card at Pomelo (card-virtual, card-physical, card-control, card-get). Pomelo calls CodeSpar's authorizer on each attempt; the authorizer looks up the card's mandate, checks expiry, currency, per-transaction cap, total cap and allowed merchants, and records the decision. Whether that decision binds depends on the mode: in observe it is recorded and the issuer is told approved; in enforce it is the answer.

01
Issue
codespar_issue

A card bound to the mandate

codespar_issue
02
Attempt
Pomelo

A merchant charges the card

03
Check
Authorizer

Expiry, currency, caps, merchants

04
Answer
Authorizer

Observe: approved · enforce: the decision

05
Record
Audit trail

Decision and reason recorded

Architecture

Pomelo signs each authorization request to POST /v1/webhooks/pomelo/authorize. The route verifies the signature; the shared core finds the card's mandate, decides (expiry, currency, per-transaction cap, total cap, allowed merchants by MCC or merchant id), persists the decision and seals it in the audit trail. In observe mode the issuer is told approved and a decision the mandate would refuse is recorded as an exception; in enforce mode the decision is the answer. An organization pause is sent as a refusal in either mode, when the issuer waits for the answer.

In code

The code, and what it assumes.

governed-agent-card.ts
// Prerequisites: CODESPAR_API_KEY set to a test key (csk_test_…), a Pomelo
// connection (it points at Pomelo's staging host) and a card already issued to
// the agent (card_id). The authorizer is not called from here: Pomelo calls it
// on every charge attempt.
import { CodeSpar } from "@codespar/sdk";

const session = await new CodeSpar().create("user_0000", { preset: "brazilian" });

// read the card at the issuer
const card = await session.execute("codespar_issue", { action: "card-get", card_id: "crd_demo" });
console.log(card.data);

// freeze it at the issuer, for instance when the agent is paused
await session.execute("codespar_issue", { action: "card-control", card_id: "crd_demo", control: "freeze", reason: "agent paused" });

Example with the published SDK (@codespar/sdk 0.16.11). Its prerequisites are in the comments. Compiling does not prove the integration: run it in test mode first.

Featured tools
codespar_issue

Issues virtual or physical cards at Pomelo, reads them, and freezes, unfreezes or cancels them.

POST /v1/webhooks/pomelo/authorize

The authorizer the issuer calls on every attempt; the agent never calls it.

Mandate

Expiry, currency, per-transaction and total caps, and the allowed merchants the authorizer checks.

See the meta-tool reference
MCP servers wired

Start with a test key.

Test keys are free. Open the sandbox, connect the providers your project uses and see which tools it can call before you build.

Governed agent card — CodeSpar | CodeSpar