Cart
The 5 operations under cart, as typed calls on the generated REST client.
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 ({ : .. });POST /v1/cart/checkout
/v1/cart/checkoutan order exists on the merchant's side, in whatever pending state that merchant uses
Finalize a cart into something payable
const = await ..("post", "/v1/cart/checkout", {
: {
: "string",
: [
{
: "variant_0000000000000000",
: 0,
: "string"
}
],
: "https://example.com/hook",
: "csm_0000000000000000",
: {
: "person@example.com",
: "Example",
: "Example",
: "string",
: "string"
},
: {
: "string",
: "string",
: "string",
: "string",
: "string",
: "string",
: "string",
: "string"
}
}
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (.) {
.(.);
}The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/cart/checkout in the HTTP reference.
POST /v1/cart/ifood/connect/start
Open an iFood login for a shopper (connect-once, and iFood cannot be bought from)
const = await ..("/v1/cart/ifood/connect/start");Parameters, body and every documented response: POST /v1/cart/ifood/connect/start in the HTTP reference.
POST /v1/cart/meli/connect/start
Open a Mercado Livre login for a shopper (connect-once, step 1 of 2)
const = await ..("/v1/cart/meli/connect/start");Parameters, body and every documented response: POST /v1/cart/meli/connect/start in the HTTP reference.
POST /v1/cart/nuvemshop/connect/start
Begin a Nuvemshop app install for a store (OAuth, step 1 of 2)
const = await ..("/v1/cart/nuvemshop/connect/start", {
: {
: "string",
: "br"
}
});Parameters, body and every documented response: POST /v1/cart/nuvemshop/connect/start in the HTTP reference.
POST /v1/cart/sessions
Price a cart at a merchant
const = await ..("post", "/v1/cart/sessions", {
: {
: "string",
: [
{
: "variant_0000000000000000",
: 0,
: "string"
}
]
}
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (.) {
.(.);
}Parameters, body and every documented response: POST /v1/cart/sessions in the HTTP reference.