Skip to content

Mandate.spend

Pays an outside party with a single-use card, inside your standing approval.

Action class
spend
Approval
Asks above your rule
Emits
Mandate.spent
Price
Free
POST https://api.sb/{your-domain}/mandates/{mandate}/spend

Its Inputs, Outputs, Effects and guards quote the hub’s Mandate.spend; this page adds what each Venue honors, its limits and a worked call. It is one of the Verbs of Ads.

Inputs

NameTypeDefaultMeaning
mandateMandateRequiredThe standing approval that covers the purchase.
amountmoneyRequiredThe amount to spend.
payeestringRequiredWho is paid.

Outputs

FieldTypeWhat null means
transactionTransactionNever null: the card Transaction.
mandateMandateNever null: your standing approval with its remaining Limit.

Effects

Action class

spend: an approval rule on spend can make it wait for your OK

Modes
  • try: Runs every check and returns what would go out, as it would go out; nothing is sent, posted or spent.
  • send: Returns a pending Action at once; Mandate.spent fires when it is done.
  • do: Waits for the Action to finish and returns the record.
Idempotency

Only with a key: the same Idempotency-Key and input return the first Action, and the same key with other input returns 409.

Saved or shared

Checks your standing approval’s Limit; above it, opens an Approval and the Action waits. Posts a cost Entry against the Action that spent.

Emits

Mandate.spent with { mandate }

Performed by

Whichever seat calls it

Price

Free on your own account. The spend is billed by the Venue directly.

Standing approval

It asks you first above its seat rule, unless a standing approval covers it: a Mandate you grant once with Mandate.authorize.

On each Venue

It acts on your own records and reaches no Venue, so every account answers the same way.

What try does

Runs every check the call meets and returns the record as it would be; nothing is stored, sent or posted.

Refuses when

The hub sets no guard of its own on this call: it refuses only on the shared checks every write meets (a missing record, a Permission the seat lacks).

When it waits

It waits for your approval when the step is over your rule and no standing approval covers it; otherwise it returns in one response.

Example

In send mode the call returns its pending Action at once, and Mandate.spent delivers the result.

You, to your agent
Pay the $49 listing fee for the property-management directory from the
paid-media mandate.
Response, in send mode
{
  "mode": "send",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_Sd3kQ9vT2w",
    "operation": "Mandate.spend",
    "status": "pending",
    "reason": "running"
  }
}

To retry, send the same Idempotency-Key: the retry returns the first answer for $0. A new key reads again.

Used by