Build a B2B checkout

Create a session linked to a buyer, have Ormuz execute the payment or credit journey, then confirm the order only when checkout, the financial decision, and the required checks are favorable, including fraud checks or any other internal, external, or partner validation.

Business objective

A checkout_session represents one checkout attempt for a company and a buyer contact. It carries the cart, amounts, addresses, return URL, and the process that decides how the buyer may pay for the order.

Checkout can start in an online journey, for example from an e-commerce site or B2B portal, but also in-store or from an assisted point of sale. In every case, the session has the same role: contextualize the buyer and transaction, run the required checks, and produce a decision that the system carrying the order can use.

The journey may result in immediate payment, an authorization, or deferred credit. Your system retains control of the order and fulfillment; Ormuz supplies the result needed to make that decision.

Responsibilities

The session answers “is checkout complete?” and “was payment or credit accepted?”. The order remains the object that answers “may we fulfill, and has fulfillment happened?”.

Prerequisites

ElementWhy it is required
MerchantDefines the checkout scope and configuration.
companyRepresents the B2B buyer to whom the financial decision applies.
contactIdentifies the person accessing the User Journey and acting for the company.
Checkout process launcherAssociates new sessions with a checkout process definition. Several launchers may coexist for the merchant.
return_urlReturns the buyer to your application after a redirect defined by the journey.

The company and contact must belong to the same merchant, and the contact must be attached to that company. When several checkout launchers are active, explicitly provide the process_definition_id to use when creating the session.

Target journey

Create the session
Interaction when needed
Financial decision
Payment
Credit
Finalize

The checkout process chooses the financial branch, produces an explicit decision, then finalizes the session.

Create the session

Your backend sends the buyer, contact, cart, amounts, and optional return URL.

Redirect to the User Journey when needed

If the process waits for a user action, open the contextualized URL returned with the session. Otherwise, let the process run without a redirect and wait for the checkout-completion webhook.

Choose the settlement method

The process may collect a payment, request an authorization, or evaluate credit capacity.

Finalize and synchronize the order

The process sets both statuses; your system rereads the session or handles its completion event.

Create the session

Call POST /v1/checkout/sessions from your backend. All three amounts are required, expressed in the currency's minor unit, and must satisfy amount_excluding_tax + amount_tax = amount_including_tax. The request does not choose payment versus credit: the checkout process carries that decision and executes the required capabilities.

POST /v1/checkout/sessions
Content-Type: application/json

{
  "merchant_id": "mer_abc123",
  "buyer_id": "cmp_abc123",
  "buyer_contact_id": "ctc_abc123",
  "currency": "eur",
  "amount_excluding_tax": 10000,
  "amount_tax": 2000,
  "amount_including_tax": 12000,
  "return_url": "https://shop.example/orders/ORD-2026-104",
  "source_reference": "ORD-2026-104",
  "line_items": [
    {
      "line_type": "service",
      "product_name": "Annual licence",
      "quantity": 1,
      "unit_amount_excluding_tax": 10000,
      "unit_amount_including_tax": 12000,
      "currency": "eur"
    }
  ]
}

The line_items describe the cart at creation time. They may represent a product, service, shipping, discount, or fees. They cannot be modified after session creation.

Merchant reference

Keep the returned cs_* ID. source_reference lets you find the session from your order number, but it does not by itself replace a deduplication strategy at creation.

Carry the financial decision in the process

The process receives the checkout_session as an input object. It can read its lines, amount, company, and contact without asking the designer to map technical identifiers.

BranchTypical capabilitiesExpected result
Immediate paymentCreate or reuse a PSP payment, collect or authorize fundspaid or authorized
Deferred creditEvaluate available capacity, apply risk rules, grant creditcredit_granted
DeclineProvider decline, insufficient capacity, or an unfavorable business rulefailed

The finalize_checkout_session node updates the financial result and lifecycle together. This explicit finalization avoids treating mere completion of User Journey screens as proof of payment.

Separate journey and financial outcome

The two status axes answer different questions. status describes the journey; payment_status describes the financial outcome.

statusMeaning
openThe session is accessible and can still be completed.
completedThe journey completed successfully.
expiredThe session passed its validity period.
cancelledThe session was explicitly canceled.
payment_statusMeaning
unpaidNo payment or credit has yet been accepted.
paidAn immediate payment was collected.
authorizedThe payment is authorized, subject to your capture policy.
credit_grantedDeferred payment was accepted.
failedThe payment attempt or credit decision failed.
cancelledThe financial attempt was canceled.
Fulfillment rule

An order is ready to be confirmed when status = completed and payment_status is paid, authorized, or credit_granted.

A completed + unpaid session does not authorize delivery. Conversely, credit_granted indicates a favorable decision without imposing the provider or mechanism carrying the risk.

Example of a completed checkout: the buyer took the net-30 payment branch and the associated subprocess.
Example of a completed checkout: the buyer took the net-30 payment branch and the associated subprocess. Enlarge

Events and tracking

EventUse
checkout_session.createdTrace creation and opening of the journey.
checkout_session.completedReread both statuses and decide whether to confirm the order.
checkout_session.expiredClose or renew an attempt that became inaccessible.
checkout_session.abandonedTrigger a reminder or abandonment analysis while the session remains open.

A User Journey is required only when the process contains user actions. A fully automated checkout can remain server-side: your integration then waits for the checkout_session.completed webhook and rereads the session before updating the order.

After a success redirect, also reread the session server-side. The redirect improves the user experience; the API and events carry the business result to use for your order.

An open session expires after 24 hours by default when you do not provide expires_at. You can also explicitly expire an open session with POST /v1/checkout/sessions/:id/expire.

Integration checklist

  • Create or resolve the buyer company and contact before checkout.
  • Configure at least one active checkout launcher and explicitly select the process_definition_id when several exist.
  • Send consistent amounts and lines in one currency.
  • Store the session ID with the source order.
  • Redirect to the User Journey URL returned by Ormuz only when the process waits for a user action.
  • For an automated journey, wait for the checkout-completion webhook without requiring a redirect.
  • Explicitly finalize status and payment_status in the process.
  • Confirm the order with the two-axis rule, never with status alone.
  • Handle webhooks idempotently and reread the session before fulfillment.
  • Plan for decline, cancellation, expiration, and abandonment cases.