Checkout Sessions
Sessions are how the kurnl Marketplace hands a subscriber over to your hosted checkout page.
The Marketplace creates a session, redirects the subscriber to your external_checkout_url
with ?session_id=<id> appended, and your page reads the session to get the plan, location,
and delivery mode. See the flow guides: CKO-03 Direct,
CKO-03 Home-Drop, CKO-03 Anonymous.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
POST |
/partner/external-checkout/sessions |
None (optional JWT) | The kurnl Marketplace’s own originator call — not a partner endpoint |
GET |
/partner/external-checkout/sessions/{session_id} |
X-Webhook-Secret |
Read session state |
PATCH |
/partner/external-checkout/sessions/{session_id} |
X-Webhook-Secret |
Update plan (upsell) or your partner reference |
A session you have read does not expire. The first time your checkout page reads a
session (GET .../sessions/{session_id}), kurnl marks it redirected — the shopper has
arrived on your page — and from then on it is never reaped. It ends as completed or
cancelled. So a slow payment, a bank transfer, or a customer who finishes the next
morning can still be provisioned.
A session that is never read expires 2 hours after it is created. That window only
has to cover the hop from the kurnl Marketplace to your checkout page. Any endpoint that
touches such a session returns 410 Gone and marks it expired on the same call; that is
final, there is no way to revive it.
Session lifecycle: pending → redirected → completed | cancelled, or
pending → expired if your page never read it. expired and cancelled surface as 410.
POST /partner/external-checkout/sessions
Creates a pending session and returns your hosted checkout URL with session_id appended.
Auth: none required. If a signed-in kurnl user’s Bearer token is supplied, the session is linked to that account (so it appears in their hub).
Request body
{ "service_provider_document_id": "uuid", "plan_version_id": "uuid", "delivery_mode": "direct | home_drop (optional)", "location_hash": "10-char hex (direct delivery, optional)", "location_identifier": "string (optional alternative to location_hash)", "unit_id": "uuid (home-drop, optional)", "building_id": "uuid (optional)", "mac_address": "string (optional)", "discount_code": "string (optional)"}discount_code is a provider code or a kurnl operator discount code the shopper entered on
kurnl before the hand-over (see validate-discount-code).
A code that does not resolve answers 400 Invalid or expired discount code and no session is created.
Response — 201 Created
{ "id": "uuid", "external_checkout_url": "https://checkout.yoursite.com/?session_id=uuid&discount_code=SPRING25", "expires_at": "2026-07-01T12:30:00Z"}In sandbox, external_checkout_url points to the kurnl fake-Stripe page instead of your
configured checkout URL. If your provider has no external_checkout_url configured, the
endpoint returns 503.
With a discount_code, the hosted URL gains &discount_code=. Kurnl stores the code on
the session and lowers its own wholesale price when the order completes; it cannot show
your price. You are trusted to pass the discount on to the customer.
Creating or patching a session does not check the building’s bulk offer. The 422 bulk_plan refusal comes at external-checkout-complete and in the anonymous callback.
Error codes
| Status | Meaning |
|---|---|
400 |
Invalid service_provider_document_id, plan_version_id, unit_id, or building_id — one of the referenced records does not exist |
400 |
Invalid or expired discount code — the code does not resolve for this plan and building; no session was created |
404 / 403 / 400 / 422 |
With a discount_code, create also runs the plan-offer checks: 404 unknown plan, 403 another provider’s plan, 400 plan not active, 422 plan_audience |
422 |
bulk_discount — a discount code on a bulk plan |
503 |
Could not check the discount code; try again. — the discount read failed |
503 |
Provider not configured for external checkout |
GET /partner/external-checkout/sessions/{session_id}
Returns the current state of a session, with the referenced plan, unit/building, and provider embedded for display on your checkout page.
Auth: X-Webhook-Secret header.
Response — 200 OK
{ "id": "uuid", "status": "pending | redirected | completed", "service_provider_document_id": "uuid", "plan_version_id": "uuid", "delivery_mode": "direct | home_drop", "location_hash": "string | null", "location_identifier": "string | null", "unit_id": "uuid | null", "building_id": "uuid | null", "partner_reference": "string | null", "partner_subscriber_id": "string | null", "discount_code": "string | null", "operator_discount": { "code": "SPRING25", "name": "Spring offer", "discount_type": "PERCENTAGE | FIXED_MONTHLY | OVERWRITE_MONTHLY", "discount_value": 25.0, "duration_months": 6, "list_price_monthly": 79.0, "promo_price_monthly": 59.25 }, "operator_offers": [ { "code": "SPRING25", "name": "Spring offer", "headline": "Use code SPRING25 at checkout for 25% off your first 6 months of internet", "discount_type": "PERCENTAGE | FIXED_MONTHLY | OVERWRITE_MONTHLY", "discount_value": 25.0, "duration_months": 6, "starts_on": "2026-11-01", "ends_on": "2026-12-31", "list_price_monthly": 79.0, "promo_price_monthly": 59.25 } ], "subscription_id": "uuid | null (set after completion)", "expires_at": "2026-07-01T12:30:00Z", "created_at": "2026-07-01T12:00:00Z", "updated_at": "2026-07-01T12:00:00Z", "plan_versions": { "id": "uuid", "retail_price_monthly": 79.0, "setup_fee": 0.0, "woocommerce_product_id": "string | null", "plans": { "id": "uuid", "name": "string", "description": "string" } }, "units": { "id": "uuid", "unit_number": "304", "postal_unit": "string | null", "floor": "3", "building_id": "uuid", "buildings": { "id": "uuid", "name": "string", "address": "string", "city": "string | null", "postal_code": "string | null", "province": "string | null", "country": "string | null" } }, "service_providers": { "id": "uuid", "name": "string" }}discount_code is the code the session carries, and operator_discount the kurnl operator
discount it resolves to (both null without one). Show the shopper promo_price_monthly for
duration_months months (null = for the life of the line), then list_price_monthly. If
the discount cannot be read, the call answers 503: retry.
operator_offers lists every kurnl operator discount the shopper may use on this session’s
building, with the monthly price it gives on this plan (promo_price_monthly for
duration_months months, null = life of the line, then list_price_monthly). Take the code
on your checkout page, match it against this list (case-insensitive), show the reduced summary,
and send it as discount_code on the completion call. operator_offers is always present: an
empty list means no kurnl operator code is valid on this building, so you can switch on the
field’s presence. If the offers cannot be read, the call answers 503: retry.
units.postal_unit is the unit’s own postal label as stored (e.g. "200" on connection
200-1), or null when the unit has none. It does not say whether the suite is shared: a
connection whose unit number is the suite itself (a bare "200" next to 200-1 and 200-2)
has null, and a unit alone in its suite may carry one. When the order is completed on a suite
with several connections, kurnl may place it on a different connection and hold it for the
operator (the completion response then has unit_confirmation_pending: true) —
see POST /external-checkout/complete.
expired and cancelled sessions are never returned as a body — they yield 410 Gone.
The embedded units.buildings object carries the full postal address of the building the
order is for — street, city, postal code, province and country. There is no buildings endpoint
on the partner API, so this embed is the only place that address reaches you: read it from the
session rather than expecting to look a building up by its id. The fields are nullable, because
kurnl holds addresses for buildings at varying levels of completeness — render defensively.
woocommerce_product_id is the intended product-mapping key for store integrations:
set it on the plan version to join a kurnl plan to the product in your own catalog.
Error codes
| Status | Meaning |
|---|---|
401 |
Missing or invalid X-Webhook-Secret |
404 |
Session not found |
410 |
Session expired or cancelled — start a new checkout |
PATCH /partner/external-checkout/sessions/{session_id}
Upsell endpoint: swap the plan while the subscriber is still on your checkout page, or
attach your own reference id. Only pending/redirected sessions are patchable.
Auth: X-Webhook-Secret header.
Request body
Only these two fields are patchable — anything else (including unit_id,
delivery_mode, service_provider_document_id) is rejected with 422.
{ "plan_version_id": "uuid (must belong to the same provider)", "partner_reference": "string"}Response — 200 OK
Returns the updated session object (same shape as GET).
Error codes
| Status | Meaning |
|---|---|
400 |
plan_version_id not found |
403 |
plan_version_id belongs to a different provider |
409 |
Session no longer patchable (already completed) |
410 |
Session expired or cancelled |
422 |
Attempted to change an immutable field |
Related
- Complete a session with subscriber PII:
POST /external-checkout/complete - Complete without sharing PII:
POST /external-checkout/anonymous-complete - Partner suspend/restore:
POST /external-checkout/subscription-status