Skip to main content
REST client

Consumer Payments

The 2 operations under consumer-payments, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

Consumer Payments

Available from @codespar/sdk 0.12.0; the version on npm is 0.15.0. Every example on this page is compiled against the installed package when these docs build: a call that does not type-check 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 ({ : .. });

POST /v1/consumer-payments/execute

POST/v1/consumer-payments/execute
Moves money

attribution of the spend belongs to the mandate

Spend by presenting the signed mandate

const  = await ..("post", "/v1/consumer-payments/execute", {
  : {
    : "string",
    : 1000,
    : "string",
    : "agt_0000000000000000",
    : "string",
    : "attempt_0000000000000000",
    : {
      : "string",
      : "string",
      : "string",
      : "tax_0000000000000000",
      : "Example",
      : "CC",
      : "F",
      : "string"
    },
    : {
      : "string",
      : "string",
      : 1,
      : "string",
      : "ses_0000000000000000",
      : "string"
    }
  }
});
// 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/consumer-payments/execute in the HTTP reference.

POST /v1/consumer-payments/execute-stream

POST/v1/consumer-payments/execute-stream
Moves money

hold, provider debit, receipt seal

Spend by presenting the mandate, with the steps streamed

const  = await ..("post", "/v1/consumer-payments/execute-stream", {
  : {
    : "string",
    : 1000,
    : "string",
    : "agt_0000000000000000",
    : "string",
    : "attempt_0000000000000000",
    : {
      : "string",
      : "string",
      : "string",
      : "tax_0000000000000000",
      : "Example",
      : "CC",
      : "F",
      : "string"
    },
    : {
      : "string",
      : "string",
      : 1,
      : "string",
      : "ses_0000000000000000",
      : "string"
    }
  }
});
// 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/consumer-payments/execute-stream in the HTTP reference.

Consumer Payments | CodeSpar