PlandalfDocsSign inStart free trial

API and webhooks

Checkouts

A checkout session is one buyer's visit to a checkout: its cart, details and status. Read sessions to see what buyers did, or create one on your server and send the buyer a link that reopens it.

Create a draft session with the buyer's details already filled in. The response has the session and a signed token starting with cks_:

curl -X POST https://admin.plandalf.dev/api/v1/checkouts \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "offer": "YOUR-CHECKOUT",
    "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "reference_id": "crm_1815" },
    "properties": { "company": "Analytical Engines" },
    "exp_seconds": 604800
  }'

offer is the checkout's slug or id. The token lasts 24 hours unless you set exp_seconds (at least 60, at most 7 days). Put it in any link to a page with the SDK, such as https://example.com/pricing?continue=cks_…, and the SDK reopens the session when the buyer arrives. See Session continuity.

A checkout that isn't in your organization returns 404.

List and read sessions

The list pages with a cursor, 15 per page by default. See Pagination. Read one session by its UUID, which is session.uuid in the SDK's results and events. A key only reads its own organization's sessions; any other UUID returns 404.

Endpoints

List checkout sessions

GET /api/v1/checkouts

Cursor-paginated, 15 per page by default (per_page to change it). Follow links.next (or pass its cursor) for the next page.

Parameters

NameInTypeWhat it is
per_page optionalqueryinteger
curl https://admin.plandalf.dev/api/v1/checkouts \
  -H "Authorization: Bearer $PLANDALF_API_KEY"

Response

{
  "data": [
    {
      "id": "string",
      "status": "string",
      "customer": {
        "id": "string",
        "reference_id": "string",
        "name": "string",
        "email": "string",
        "currency": "string",
        "timezone": "string",
        "has_default_payment_method": true,
        "is_new_customer": true,
        "created_at": "string"
      },
      "expires_at": "string",
      "finalized_at": "string",
      "metadata": {},
      "discounts": null,
      "properties": {},
      "line_items": [
        {
          "id": "string",
          "quantity": 0,
          "price": {
            "id": null,
            "type": "one_time",
            "amount": null,
            "currency": null,
            "name": null,
            "lookup_key": null,
            "renew_interval": null,
            "gateway_price_id": null
          }
        }
      ],
      "total": 0,
      "taxes": 0,
      "inclusive_taxes": 0,
      "subtotal": 0,
      "currency": "string",
      "cart_template_url": "string",
      "payment_confirmed_at": "string",
      "payment_method_locked": true,
      "payment_method": {
        "id": 0,
        "type": "string",
        "billing_details": "string",
        "properties": null,
        "brand": "string",
        "last4": "string",
        "exp_month": 0,
        "exp_year": 0,
        "display_name": "string"
      },
      "order": {
        "id": "string",
        "order_number": 0,
        "status": {
          "value": "string",
          "label": "string"
        },
        "total_amount": 0,
        "currency": "string",
        "completed_at": "string",
        "customer": {
          "id": 0,
          "name": "string",
          "email": "string"
        },
        "items": "string"
      }
    }
  ],
  "path": "string",
  "per_page": 0,
  "next_cursor": "string",
  "next_page_url": "string",
  "prev_cursor": "string",
  "prev_page_url": "string"
}

Errors

StatusWhen
401The API key or OAuth token is missing or invalid.

Create a checkout session

POST /api/v1/checkouts

Creates a draft session for one of the organization's offers on your server and returns it with a signed cks_ token. Put the token in any URL (a "continue your checkout" email, a QR code, a hand-off from your logged-in app) and the SDK resumes the session when the customer arrives. customer pre-fills the session; properties is stored on it. exp_seconds sets the token's lifetime: 24 hours by default, at most 7 days. Returns 404 when the offer isn't in this organization.

Body

FieldTypeWhat it is
offerstring
properties optionalobjectYour own key/value data, stored on the session.
exp_seconds optionalinteger | null
customer optionalobject
curl -X POST https://admin.plandalf.dev/api/v1/checkouts \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"offer":"string","properties":{},"exp_seconds":0,"customer":{"email":"string","name":"string","reference_id":"string"}}'

Response

{
  "session": "string",
  "token": "string"
}

Errors

StatusWhen
401The API key or OAuth token is missing or invalid.
404Nothing with that id or code exists in this organization.
422The request failed validation; errors lists the problems by field.

Retrieve a checkout session

GET /api/v1/checkouts/{checkout}

checkout is the session's UUID.

Parameters

NameInTypeWhat it is
checkoutpathstringThe checkout UUID
curl https://admin.plandalf.dev/api/v1/checkouts/:checkout \
  -H "Authorization: Bearer $PLANDALF_API_KEY"

Response

{
  "id": "string",
  "status": "string",
  "customer": {
    "id": "string",
    "reference_id": "string",
    "name": "string",
    "email": "string",
    "currency": "string",
    "timezone": "string",
    "has_default_payment_method": true,
    "is_new_customer": true,
    "created_at": "string"
  },
  "expires_at": "string",
  "finalized_at": "string",
  "metadata": {},
  "discounts": null,
  "properties": {},
  "line_items": [
    {
      "id": "string",
      "quantity": 0,
      "price": {
        "id": 0,
        "type": "one_time",
        "amount": 0,
        "currency": "string",
        "name": "string",
        "lookup_key": "string",
        "renew_interval": "string",
        "gateway_price_id": "string"
      }
    }
  ],
  "total": 0,
  "taxes": 0,
  "inclusive_taxes": 0,
  "subtotal": 0,
  "currency": "string",
  "cart_template_url": "string",
  "payment_confirmed_at": "string",
  "payment_method_locked": true,
  "payment_method": {
    "id": 0,
    "type": "string",
    "billing_details": "string",
    "properties": null,
    "brand": "string",
    "last4": "string",
    "exp_month": 0,
    "exp_year": 0,
    "display_name": "string"
  },
  "order": {
    "id": "string",
    "order_number": 0,
    "status": {
      "value": "string",
      "label": "string"
    },
    "total_amount": 0,
    "currency": "string",
    "completed_at": "string",
    "customer": {
      "id": 0,
      "name": "string",
      "email": "string"
    },
    "items": "string"
  }
}

Errors

StatusWhen
401The API key or OAuth token is missing or invalid.
404Nothing with that id or code exists in this organization.