Skip to content
Internal docs

POST /external-checkout/complete

See the full guides: CKO-03 Direct Delivery and CKO-03 Home-Drop Delivery.

Endpoint

POST /partner/external-checkout/complete

Authentication

X-Webhook-Secret header — your pre-shared webhook secret.

Routing — session path (session_id present)

With a session_id, delivery_mode is ignored. kurnl resolves the session’s building_id to the building’s line type (operator-side configuration), checks whether the suite’s router is already online, and routes:

Building line type Session carries Path Response
first a resolvable location_hash Provision the port directly (ACTIVE) 200 with job_id
first a unit_id and no port Provision the suite’s port (ACTIVE) — a suite with several connections is held for the operator’s confirmation, see Shared suites 200 with job_id (null while held)
second / third a unit_id whose router is already online (suite of one) Provision the suite’s port (ACTIVE) 200 with job_id
second / third a unit_id whose router is not online, or a shared suite Operator install job (PENDING_INSTALL) 200 without job_id
unclassified (NULL) a unit_id Operator install job (PENDING_INSTALL), even when the suite’s router is online 200 without job_id

A suite’s router counts as online when it answered within the last 15 minutes. The check runs when the order arrives; when kurnl cannot read the router’s state, the order takes the install path. GET /serviceability/units shows the same state per suite as cpe_ready before the shopper chooses.

A first-line building is reached two ways. From the captive portal the port is known (location_hash) and kurnl provisions it immediately. From address search or a QR landing there is no port — only a building and a suite — so kurnl provisions the suite’s own port (409 suite_not_wired when none is wired), or, for a suite with several connections, holds the order for the operator (below).

kurnl fails closed — a payload carrying neither a port nor a unit_id is rejected with 422 (see error codes). A switch port is provisioned without a visit only on an explicit first-line building, or for a second- or third-line suite whose router is already online; outside first line a port alone is never enough. The same rule now applies to the no-session payload: delivery_mode says what you have, the building’s line type decides the outcome.

Shared suites

A suite can have several connections (200-1, 200-2 behind postal suite 200). The session’s units.postal_unit is the unit’s own stored label and does not tell you this — read unit_confirmation_pending in the response. When the session’s unit_id is such a suite, kurnl re-anchors the order to the suite’s first free connection and holds it until the kurnl operator confirms which connection is the customer’s:

{
"job_id": null,
"subscription_id": "uuid",
"subscriber_id": "uuid",
"message": "Order accepted. The connection in the shared suite is being confirmed; provisioning starts once it is.",
"route": "provision",
"billing_owner": "partner",
"unit_confirmation_pending": true
}

On a first-line building route stays provision, but job_id is null, the subscription is PENDING, and no subscription.activated webhook fires. Provisioning and the subscription.activated webhook happen when the operator confirms the connection. On the install route the response is the install-job shape below plus unit_confirmation_pending: true. A retry with the same session_id returns the existing order. Any other repeat of the same subscriber and plan on the suite returns the existing order on the provision (first-line) route, and is refused with 409 Unit already has a pending or active subscription on the install route — it never takes a second connection. When every connection of the suite is taken the call is refused with 409 no_free_connection.

When the subscriber arrived via a kurnl Marketplace redirect, you have a session_id (from the ?session_id= query parameter). The session is the source of truth for the provider, plan, location/unit, building, and MAC address — you only supply the subscriber PII:

{
"session_id": "uuid",
"partner_reference": "string (optional — stored on the session)",
"subscriber": {
"email": "string",
"username": "string",
"password": "string (optional, min 8 chars)",
"customer_type": "RESIDENTIAL | BUSINESS",
"invoice_contact_detail": { "firstname": "", "lastname": "", "email": "" },
"contract_contact_detail": { "firstname": "", "lastname": "", "email": "" },
"invoice_address": {
"street": "", "housenumber": "", "postalcode": "",
"city": "", "province": "", "country": "Canada"
}
}
}

The discount the session itself carries (discount_code / operator_discount on the session, entered on kurnl before the hand-over) is applied at completion: kurnl records it and lowers its wholesale price for the promo months. You are trusted to pass the discount on to the customer. That code is resolved as of the day the session was created, so one that was valid at the hand-over is honoured even if its dates ended in between. If it was archived meanwhile, it lapses silently: the order still goes through, at the campaign or list price.

A discount_code you send in the body is different. On the session form it is the code the shopper typed on your page; on the no-session form it is a code you pass directly. On the session form kurnl checks it as of the hand-over day against the session’s building and honours it if it is a kurnl operator code from the session’s operator_offers (even if its dates ended after the hand-over) or one of your own discount codes, as on the no-session form. Anything else — a typo, another building’s code, or a discount withdrawn in between — is a 400 (Invalid or expired discount code) and nothing is created. Sending back the session’s own code (for example the discount_code from the hand-over URL) is the same as sending none. Check the code against operator_offers or your own codes before you charge; on a 400, retry the completion without the code and the order goes through at the plan’s campaign price if a campaign is live, otherwise at the list price. A bulk plan takes no discount code (422 bulk_discount). If the code cannot be checked right now, the call answers 503 (Could not check the discount code; try again.): retry.

If both the session and your payload carry a location_hash or mac_address and they disagree, the session value wins (the conflict is logged).

Idempotent: a second call with the same session_id returns the existing subscription without re-provisioning — response shape {subscription_id, subscriber_id, message, unit_confirmation_pending} (no job_id), where subscriber_id is the real kurnl subscriber UUID.

Request body — explicit fields (legacy, no session)

For flows that do not go through a Marketplace session, pass the provisioning fields yourself. delivery_mode states which fields you are sending; the building’s line type (and, outside first line, whether the suite’s router is already online) still decides whether the order provisions a port or raises an install job, so a mismatch is refused with 422:

{
"service_provider_document_id": "uuid",
"plan_version_id": "uuid",
"delivery_mode": "direct | home_drop",
"location_hash": "10-char hex (required when delivery_mode is 'direct')",
"unit_id": "uuid (required when delivery_mode is 'home_drop')",
"subscriber": { "...": "same subscriber object as above" }
}

This flow is idempotent per (subscriber email, plan version, location): a retry returns the existing subscription with "Subscription already exists (idempotent replay)" or "Provisioning already in progress" — job_id may be empty on replay.

Response — 200 OK (provisioned — first-line building, or a suite whose router is already online)

{
"job_id": "uuid",
"subscription_id": "uuid",
"subscriber_id": "uuid",
"message": "Provisioning started"
}

Webhook: subscription.activated, then provisioning.completed / provisioning.failed.

Response — 200 OK (install job — the suite needs a visit or a shipped router)

{
"subscription_id": "uuid",
"subscriber_id": "uuid",
"message": "Subscription pending installation. Call /provisioning/confirm-install when the port is ready.",
"unit_confirmation_pending": false
}

unit_confirmation_pending is true when the unit is a shared suite whose connection the operator still has to confirm; false otherwise.

No job_id; subscription status is PENDING_INSTALL. Webhook: subscription.pending_install (not subscription.activated).

Error codes

Status Error
401 Missing or invalid X-Webhook-Secret
403 Plan version does not belong to your service provider
404 Session not found; Location not found for location_hash; Plan version … not found; Unit … not found
409 Unit already has a pending or active subscription (install-job path; for a shared suite, a second order of the same subscriber and plan on the suite)
409 {"code": "no_free_connection", "message": "Every connection of this suite is taken."} — every connection of a shared suite is taken
409 {"code": "port_in_use", "message": "This port already has a live subscription."} — another live order is on the port: another subscriber’s, or another plan version of this subscriber. A retry of the same order gets its replay instead (unless its line is in PAYMENT_FAILED). Nothing was created (port path, with or without a session)
503 Could not check whether the port is free; try again. — retryable; nothing was created
410 Session expired or cancelled — nested body: {"detail": {"detail": "Session expired", "expired_at": "…"}}; the cancelled variant has no expired_at
422 First-line building requires a resolvable port (location_hash) or a unit; the session carries neither.
422 Building line type '…' requires an operator install job, but the session has no unit_id — refusing to provision.
422 {"detail": {"code": "plan_audience", "message": "…", "target_audience": "EXISTING_SUBSCRIBERS"}} — the plan is for existing customers only
422 {"detail": {"code": "bulk_plan", "message": "…", "building_bulk": true, "plan_bulk": false}} — the plan and the building do not match. A paid plan ordered in a bulk building answers "This building includes internet in the rent — choose one of its included plans."; a bulk plan ordered elsewhere answers "<Plan name> is only available in buildings that include internet in the rent.". building_bulk and plan_bulk say which side each is. Nothing was created; offer a plan from the building’s plans in serviceability
503 Could not verify the building's bulk offer; try again. — retryable; nothing was created
422 {"detail": {"code": "not_covered", "message": "This building is not covered by <provider>. …", "building_id": "…"}} — your provider does not cover the building (no ticked division, picked building or contract). Nothing was created
503 Could not verify the building's coverage; try again. · Could not read the line's building; try again. — retryable; nothing was created
422 {"detail": {"code": "plan_not_offered", "message": "<Plan> is not offered in this building.", "building_id": "…"}} — your provider does not offer this plan in the building. Nothing was created
503 Could not verify the building's plan offer; try again. — retryable; nothing was created
422 Invalid location_hash format; missing required fields in the no-session payload
400 The sign-in service refused subscriber.password; the message gives its reason (e.g. Password should be at least 6 characters.). Only for a new account; nothing was created, and the session can be completed again with another password
400 Plan version not active / Plan version not yet active; location has no switch; provider has no VLAN; unparseable port
400 Invalid or expired discount code — session form: the discount_code is neither a kurnl operator code from the session’s operator_offers nor one of your own discount codes, or it no longer resolves; no-session form: it does not resolve. Nothing was created
422 {"detail": {"code": "bulk_discount", "message": "This plan is included in the rent — discount codes do not apply."}} — the plan version is a bulk plan; it takes no discount code. Nothing was created
503 Could not check the discount code; try again. — retryable; nothing was created
429 Rate limit exceeded (120 req/min)