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.
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.
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
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.
codespar_issueA card bound to the mandate
codespar_issueA merchant charges the card
Expiry, currency, caps, merchants
Observe: approved · enforce: the decision
Decision and reason recorded
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.
The code, and what it assumes.
// 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.
codespar_issueIssues virtual or physical cards at Pomelo, reads them, and freezes, unfreezes or cancels them.
POST /v1/webhooks/pomelo/authorizeThe authorizer the issuer calls on every attempt; the agent never calls it.
MandateExpiry, currency, per-transaction and total caps, and the allowed merchants the authorizer checks.
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.