Collect
The 29 operations under collect, as typed calls on the generated REST client.
Available from @codespar/sdk 0.12.0; the version on npm is 0.16.23. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.23, 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/collect/attempts
List the project's Collect charges with their payments
const = await ..("/v1/collect/attempts");Parameters, body and every documented response: GET /v1/collect/attempts in the HTTP reference.
GET /v1/collect/attempts/{attemptId}/artifact
The WhatsApp material of an attempt
const = await ..("/v1/collect/attempts/{attemptId}/artifact", {
: {
: "attempt_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/attempts/{attemptId}/artifact in the HTTP reference.
POST /v1/collect/attempts/{attemptId}/test-pay
/v1/collect/attempts/{attemptId}/test-paypays the attempt's charge FOR REAL at the Celcoin sandbox
Pay a Test attempt's charge from the shared Test payer (the payer button)
const = await ..("post", "/v1/collect/attempts/{attemptId}/test-pay", {
: {
: "attempt_0000000000000000"
}
});
// 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 (.) {
.(.);
}The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/collect/attempts/{attemptId}/test-pay in the HTTP reference.
GET /v1/collect/links
List this project's Collect links
const = await ..("/v1/collect/links");Parameters, body and every documented response: GET /v1/collect/links in the HTTP reference.
POST /v1/collect/links
Create a Collect link with its first draft
const = await ..("/v1/collect/links", {
: {
: "csm_0000000000000000",
: "2026-01-15T12:00:00.000Z",
: "one_time",
: {
: "Example",
: "string",
: "string",
: [
{
: "Example",
: 0,
: 1000
}
],
: {
: "https://example.com/hook",
: "string",
: "string",
: {
: "string",
: "string"
}
},
: [
"page"
],
: 0,
: {
: "optional",
: "off"
},
: "string"
},
: {
: "Example",
: "string",
: "string",
: "string",
: {
: "string",
: "string",
: "string",
: "string",
: "string",
: "string"
}
},
: "string",
: "string"
}
});Parameters, body and every documented response: POST /v1/collect/links in the HTTP reference.
GET /v1/collect/links/stats
The project's Collect numbers over the last 30 days
const = await ..("/v1/collect/links/stats");Parameters, body and every documented response: GET /v1/collect/links/stats in the HTTP reference.
GET /v1/collect/links/{linkId}
Read a Collect link
const = await ..("/v1/collect/links/{linkId}", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/links/{linkId} in the HTTP reference.
PATCH /v1/collect/links/{linkId}
Change a draft link's validity or receiving consumer
const = await ..("patch", "/v1/collect/links/{linkId}", {
: {
: "link_0000000000000000"
},
: {
: "2026-01-15T12:00:00.000Z",
: "csm_0000000000000000"
}
});
// 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: PATCH /v1/collect/links/{linkId} in the HTTP reference.
POST /v1/collect/links/{linkId}/archive
Archive a Collect link
const = await ..("/v1/collect/links/{linkId}/archive", {
: {
: "link_0000000000000000"
},
: {
: "cancel"
}
});Parameters, body and every documented response: POST /v1/collect/links/{linkId}/archive in the HTTP reference.
GET /v1/collect/links/{linkId}/attempts
List a Collect link's attempts
const = await ..("/v1/collect/links/{linkId}/attempts", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/links/{linkId}/attempts in the HTTP reference.
POST /v1/collect/links/{linkId}/attempts
Issue a Pix attempt for the partner's channel
const = await ..("post", "/v1/collect/links/{linkId}/attempts", {
: {
: "link_0000000000000000"
},
: {
: "whatsapp",
: {},
: false,
: "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/collect/links/{linkId}/attempts in the HTTP reference.
PUT /v1/collect/links/{linkId}/draft
Replace the draft of a Collect link
const = await ..("/v1/collect/links/{linkId}/draft", {
: {
: "link_0000000000000000"
},
: {
: "Example",
: "string",
: "string",
: [
{
: "Example",
: 0,
: 1000
}
],
: {
: "https://example.com/hook",
: "string",
: "string",
: {
: "string",
: "string"
}
},
: [
"page"
],
: 0,
: {
: "optional",
: "off"
},
: "string"
}
});Parameters, body and every documented response: PUT /v1/collect/links/{linkId}/draft in the HTTP reference.
POST /v1/collect/links/{linkId}/pause
Pause a Collect link
const = await ..("/v1/collect/links/{linkId}/pause", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: POST /v1/collect/links/{linkId}/pause in the HTTP reference.
GET /v1/collect/links/{linkId}/payments
List a Collect link's payments
const = await ..("/v1/collect/links/{linkId}/payments", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/links/{linkId}/payments in the HTTP reference.
POST /v1/collect/links/{linkId}/publish
Publish a Collect link
const = await ..("post", "/v1/collect/links/{linkId}/publish", {
: {
: "link_0000000000000000"
},
: {
: "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/collect/links/{linkId}/publish in the HTTP reference.
GET /v1/collect/links/{linkId}/refunds
The refund obligations of a link's exception payments
const = await ..("/v1/collect/links/{linkId}/refunds", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/links/{linkId}/refunds in the HTTP reference.
POST /v1/collect/links/{linkId}/resume
Resume a paused Collect link
const = await ..("post", "/v1/collect/links/{linkId}/resume", {
: {
: "link_0000000000000000"
}
});
// 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/collect/links/{linkId}/resume in the HTTP reference.
GET /v1/collect/links/{linkId}/subscriptions
The adhesions of a recurring offer
const = await ..("/v1/collect/links/{linkId}/subscriptions", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/links/{linkId}/subscriptions in the HTTP reference.
POST /v1/collect/payments/{paymentId}/honor
Keep a late payment instead of refunding it
const = await ..("/v1/collect/payments/{paymentId}/honor", {
: {
: "payment_0000000000000000"
}
});Parameters, body and every documented response: POST /v1/collect/payments/{paymentId}/honor in the HTTP reference.
POST /v1/collect/payments/{paymentId}/refund
Refund a late payment instead of keeping it
const = await ..("/v1/collect/payments/{paymentId}/refund", {
: {
: "payment_0000000000000000"
}
});Parameters, body and every documented response: POST /v1/collect/payments/{paymentId}/refund in the HTTP reference.
GET /v1/collect/receivers
The consumers that could receive a Collect charge in this project
const = await ..("/v1/collect/receivers");Parameters, body and every documented response: GET /v1/collect/receivers in the HTTP reference.
GET /v1/collect/receivers/default
The project's default receiver for links that name none
const = await ..("/v1/collect/receivers/default");Parameters, body and every documented response: GET /v1/collect/receivers/default in the HTTP reference.
PUT /v1/collect/receivers/default
Configure (or clear) the project's default receiver
const = await ..("put", "/v1/collect/receivers/default", {
: {
: "csm_0000000000000000"
}
});
// 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: PUT /v1/collect/receivers/default in the HTTP reference.
GET /v1/collect/subscriptions/{subscriptionId}
One adhesion of a recurring offer
const = await ..("/v1/collect/subscriptions/{subscriptionId}", {
: {
: "subscription_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/subscriptions/{subscriptionId} in the HTTP reference.
POST /v1/collect/subscriptions/{subscriptionId}/cancel
Cancel an adhesion commercially
const = await ..("post", "/v1/collect/subscriptions/{subscriptionId}/cancel", {
: {
: "subscription_0000000000000000"
},
: {
: "customer_request"
}
});
// 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/collect/subscriptions/{subscriptionId}/cancel in the HTTP reference.
POST /v1/collect/subscriptions/{subscriptionId}/test-pay
/v1/collect/subscriptions/{subscriptionId}/test-paypays the adhesion's journey 3 QR FOR REAL at the Celcoin sandbox
Pay a Test adhesion's first payment from the shared Test payer (Pagar (teste))
const = await ..("post", "/v1/collect/subscriptions/{subscriptionId}/test-pay", {
: {
: "subscription_0000000000000000"
}
});
// 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 (.) {
.(.);
}The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/collect/subscriptions/{subscriptionId}/test-pay in the HTTP reference.
GET /v1/collect/{linkId}
The hosted page's read of a Collect link (public)
const = await ..("/v1/collect/{linkId}", {
: {
: "link_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/collect/{linkId} in the HTTP reference.
POST /v1/collect/{linkId}/attempts
/v1/collect/{linkId}/attemptsevery new attempt is a charge at the issuer
Ask a Collect link for a payable Pix (public)
const = await ..("post", "/v1/collect/{linkId}/attempts", {
: {
: "link_0000000000000000"
},
: {
: "string",
: {},
: false
}
});
// 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/collect/{linkId}/attempts in the HTTP reference.
POST /v1/collect/{linkId}/subscriptions/{subscriptionId}
A payer follows their adhesion to a recurring offer (public)
const = await ..("/v1/collect/{linkId}/subscriptions/{subscriptionId}", {
: {
: "link_0000000000000000",
: "subscription_0000000000000000"
},
: {
: "string"
}
});Parameters, body and every documented response: POST /v1/collect/{linkId}/subscriptions/{subscriptionId} in the HTTP reference.