Skip to main content
REST client

Consumer Mandates

The 7 operations under consumer-mandates, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

Available from @codespar/sdk 0.12.0; the version on npm is 0.16.18. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.18, the version this site installs: a call that does not type-check against it fails the build.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

GET /v1/consumers/mandates/{id}/card

The card bound to a mandate, and its recent authorizations

const  = await ..("/v1/consumers/mandates/{id}/card", {
  : {
    : "mandate_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/consumers/mandates/{id}/card in the HTTP reference.

DELETE /v1/consumers/mandates/{id}/card

Unbind the card from a mandate

const  = await ..("/v1/consumers/mandates/{id}/card", {
  : {
    : "mandate_0000000000000000"
  }
});

Parameters, body and every documented response: DELETE /v1/consumers/mandates/{id}/card in the HTTP reference.

POST /v1/consumers/mandates/{id}/pause

POST/v1/consumers/mandates/{id}/pause
Deprecated

Pause an allowance (legacy path)

const  = await ..("post", "/v1/consumers/mandates/{id}/pause", {
  : {
    : "mandate_0000000000000000"
  },
  : {
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/consumers/mandates/{id}/pause in the HTTP reference.

GET /v1/consumers/mandates/{id}/receipts

The spend feed for one allowance

const  = await ..("/v1/consumers/mandates/{id}/receipts", {
  : {
    : "mandate_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/consumers/mandates/{id}/receipts in the HTTP reference.

POST /v1/consumers/mandates/{id}/resume

POST/v1/consumers/mandates/{id}/resume
Deprecated

Resume a paused allowance (legacy path)

const  = await ..("post", "/v1/consumers/mandates/{id}/resume", {
  : {
    : "mandate_0000000000000000"
  },
  : {
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/consumers/mandates/{id}/resume in the HTTP reference.

POST /v1/consumers/mandates/{id}/revoke

POST/v1/consumers/mandates/{id}/revoke
Deprecated

Revoke an allowance (legacy path)

const  = await ..("post", "/v1/consumers/mandates/{id}/revoke", {
  : {
    : "mandate_0000000000000000"
  },
  : {
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/consumers/mandates/{id}/revoke in the HTTP reference.

POST /v1/consumers/mandates/{id}/spend

POST/v1/consumers/mandates/{id}/spend
Moves money

Moves money out under a mandate already projected into this organization

Spend under a mandate already projected here

const  = await ..("post", "/v1/consumers/mandates/{id}/spend", {
  : {
    : "mandate_0000000000000000"
  },
  : {
    : 1000,
    : "string",
    : "agt_0000000000000000",
    : "attempt_0000000000000000",
    : {
      : "string",
      : "string",
      : "string",
      : "tax_0000000000000000",
      : "Example",
      : "CC",
      : "F",
      : "string"
    },
    : {
      : "string",
      : "string",
      : 1,
      : "string",
      : "ses_0000000000000000",
      : "2026-01-15T12:00:00.000Z"
    },
    : {
      : "agent",
      : "paymentactor_0000000000000000",
      : "string"
    },
    : {
      : "string",
      : "string"
    },
    : "ses_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/consumers/mandates/{id}/spend in the HTTP reference.

Consumer Mandates | CodeSpar