Skip to main content
REST client

Payment Links

The 5 operations under payment-links, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

Payment Links

Available from @codespar/sdk 0.12.0; the version on npm is 0.12.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 ({ : .. });
GET/v1/payment-links

List the payment links in this project

const  = await ..("/v1/payment-links");

Parameters, body and every documented response: GET /v1/payment-links in the HTTP reference.

POST /v1/payment-links

POST/v1/payment-links

Create a multi-rail payment link

const  = await ..("post", "/v1/payment-links", {
  : {
    : "example",
    : "Example",
    : "string",
    : [
      {
        : "x402",
        : "1000",
        : "USDC",
        : {
          : "byo",
          : "string",
          : "csm_0000000000000000"
        }
      }
    ],
    : true,
    : 1,
    : "2026-01-15T12:00:00.000Z",
    : "https://example.com/hook",
    : {}
  }
});
// 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/payment-links in the HTTP reference.

GET /v1/payment-links/{id}

GET/v1/payment-links/{id}

Read one payment link

const  = await ..("/v1/payment-links/{id}", {
  : {
    : "pl_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/payment-links/{id} in the HTTP reference.

PATCH /v1/payment-links/{id}

PATCH/v1/payment-links/{id}

Update a payment link's title, copy, expiry, redirect or active flag

const  = await ..("patch", "/v1/payment-links/{id}", {
  : {
    : "pl_0000000000000000"
  },
  : {
    : "Example",
    : true
  }
});
// 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: PATCH /v1/payment-links/{id} in the HTTP reference.

DELETE /v1/payment-links/{id}

DELETE/v1/payment-links/{id}

Delete a payment link

const  = await ..("delete", "/v1/payment-links/{id}", {
  : {
    : "pl_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 (.) {
  .(.);
}

Parameters, body and every documented response: DELETE /v1/payment-links/{id} in the HTTP reference.

Payment Links | CodeSpar