RespireSoft InvoicingAPI docsReferenceWebhooks

Checkout sessions

A hosted payment page for an invoice or an amount. The `url` is shown once, in the answer of create.

List checkout sessions

GET /v1/checkout_sessions

Key scope checkout:read

Newest first, 20 at a time. See pagination.

Query: status, source, limit, starting_after

curl
curl "https://api.invoicing.respiresoft.com/v1/checkout_sessions?limit=10" \
  -H "Authorization: Bearer $RESPIRESOFT_KEY"
Node
const res = await fetch("https://api.invoicing.respiresoft.com/v1/checkout_sessions?limit=10", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
  },
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document
PHP
$ch = curl_init("https://api.invoicing.respiresoft.com/v1/checkout_sessions?limit=10");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
    ],
]);
$data = json_decode(curl_exec($ch), true);
Python
import os, uuid, requests

res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/checkout_sessions?limit=10",
    headers={
        "Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
    },
)
data = res.json()

Retrieve checkout session

GET /v1/checkout_sessions/{id}

Key scope checkout:read

curl
curl "https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID" \
  -H "Authorization: Bearer $RESPIRESOFT_KEY"
Node
const res = await fetch("https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
  },
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document
PHP
$ch = curl_init("https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
    ],
]);
$data = json_decode(curl_exec($ch), true);
Python
import os, uuid, requests

res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID",
    headers={
        "Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
    },
)
data = res.json()

Create checkout session

POST /v1/checkout_sessions

Key scope checkout:write. Send an Idempotency-Key header

FieldTypeMeaning
invoicestringInvoice id. Send this or amount.
amountintegerMinor units. Needs currency.
currencystring
descriptionstring
methodsarray
success_urlstring
cancel_urlstring
localestring
expires_inintegerSeconds, 300 to 604800.
curl
curl -X POST "https://api.invoicing.respiresoft.com/v1/checkout_sessions" \
  -H "Authorization: Bearer $RESPIRESOFT_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"invoice":"inv_…","success_url":"https://shop.example/thanks"}'
Node
const res = await fetch("https://api.invoicing.respiresoft.com/v1/checkout_sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "invoice": "inv_…",
    "success_url": "https://shop.example/thanks"
  }),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document
PHP
$ch = curl_init("https://api.invoicing.respiresoft.com/v1/checkout_sessions");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
        "Idempotency-Key: " . bin2hex(random_bytes(16)),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "invoice" => "inv_…",
        "success_url" => "https://shop.example/thanks",
    ]),
]);
$data = json_decode(curl_exec($ch), true);
Python
import os, uuid, requests

res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/checkout_sessions",
    headers={
        "Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
      "invoice": "inv_…",
      "success_url": "https://shop.example/thanks"
    },
)
data = res.json()

Expire a checkout session

POST /v1/checkout_sessions/{id}/expire

Key scope checkout:write. Send an Idempotency-Key header

curl
curl -X POST "https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID/expire" \
  -H "Authorization: Bearer $RESPIRESOFT_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Node
const res = await fetch("https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID/expire", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document
PHP
$ch = curl_init("https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID/expire");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
        "Idempotency-Key: " . bin2hex(random_bytes(16)),
    ],
]);
$data = json_decode(curl_exec($ch), true);
Python
import os, uuid, requests

res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/checkout_sessions/ID/expire",
    headers={
        "Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
data = res.json()