Your first journey

Docs · Learn

Copy as Markdown
View as Markdown

Your first journey

Build the checkout from the home page in six steps, in about 10 minutes.

UJN 0.1 draft · revision 23 · November 29, 2026 · Changes

Every step on this page is drawn by the same PlantUML build that draws the rest of the site, so you can read along without running anything. To draw your own copy as you type, use the Try it page: its live drawing needs the local render server, which is not public yet, so until then the page shows its samples as they were drawn when the site was built. You can also write the steps by hand, on paper or in any text editor, and check them when you can draw them. At the end you have the core of the home page's checkout: a screen, a payment step, a trip to the bank app and back, a success end, a failure end and a planned Pay later screen, with 0 warnings.

Step 1: A first screen#

A journey file runs from @startujn to @endujn, and the journey line, journey CHECKOUT "Checkout", comes before any node; the description under it says what the journey is for (section 3). Add a start, where the journey begins, and a view, a screen the user sees: each is a keyword, a handle and a block of key: value pairs (section 4). The arrow from_cart --> checkout joins them by their handles, with no label, because an arrow out of a start takes no trigger (17.4).

Example 1Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout } from_cart --> checkout@endujn
Drawing of Example 1: start from_cart, view Checkout. Arrows: from_cart to Checkout.
Drawn from this text2 nodes · 1 arrow0 warnings

The drawing shows the start, From the cart, and an arrow to the Checkout view with its route.

Step 2: A second step and a trigger#

Authorizing the payment is something the system does between screens, so it is an action (section 14). The arrow from Checkout needs a trigger, what the user does, in square brackets after a colon: [Pay] (13.4). Without it, the module warns an exit from a view needs a trigger, written after a colon: [Trigger]. The payload in the arrow's block lists what crosses the arrow: the card and the amount (13.6).

Example 2Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout }action authorize { title: "Authorize payment"; description: "Asks the card issuer" } from_cart --> checkoutcheckout --> authorize : [Pay] { payload: [card, amount] }@endujn
Drawing of Example 2: start from_cart, view Checkout, action Authorize payment. Arrows: from_cart to Checkout; Checkout to Authorize payment on Pay.
Drawn from this text3 nodes · 2 arrows0 warnings

Authorize payment now follows Checkout, with the Pay pill on the arrow and {card, amount} under it.

Step 3: When the card is refused#

Add an end of type failure: the journey ended without its outcome (17.2). An exit from an action takes no trigger, since the system acts and not the user; the text after the colon is a guard, which says when this exit is the one taken (13.5). -x-> marks a failure path, and -down- asks the layout to put the end under the action: a direction hint is a wish, never an error (13.3).

Example 3Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout }action authorize { title: "Authorize payment"; description: "Asks the card issuer" }end refused { type: failure; description: "Card refused" } from_cart --> checkoutcheckout --> authorize : [Pay] { payload: [card, amount] }authorize -down-x-> refused : card refused@endujn
Drawing of Example 3: start from_cart, view Checkout, action Authorize payment, end refused. Arrows: from_cart to Checkout; Checkout to Authorize payment on Pay; Authorize payment to refused.
Drawn from this text4 nodes · 3 arrows0 warnings

A red arrow with a cross, labeled card refused, now runs down from Authorize payment to the failure end.

Step 4: Leave the app and come back#

To approve the payment, the user leaves your app for their bank app: that is a handoff, with the channel they go to and the timeout, how long the session out there stays valid (15.3). The action gets a second exit, guarded approval needed; of an action's guarded exits, exactly one fires (14.4). A handoff is left only by its resume arrows, written ..> with a trigger: [Approve] goes on to Order confirmed, and [Decline], written .x.> because it failed, goes back to Checkout to try another card (13.7, 15.4). Approve needs somewhere to land, so declare Order confirmed now; step 5 finishes it.

Example 4Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout }action authorize { title: "Authorize payment"; description: "Asks the card issuer" }end refused { type: failure; description: "Card refused" }handoff bank_app { title: "Bank app"; description: "Approve the payment"; channel: bank app; timeout: 5 min }view confirmed { title: "Order confirmed" } from_cart --> checkoutcheckout --> authorize : [Pay] { payload: [card, amount] }authorize -down-x-> refused : card refusedauthorize --> bank_app : approval neededbank_app ..> confirmed : [Approve]bank_app .x.> checkout : [Decline]@endujn
Drawing of Example 4: start from_cart, view Checkout, action Authorize payment, end refused, handoff Bank app, view Order confirmed. Arrows: from_cart to Checkout; Checkout to Authorize payment on Pay; Authorize payment to refused; Authorize payment to Bank app; Bank app to Order confirmed on Approve; Bank app to Checkout on Decline.
Drawn from this text6 nodes · 6 arrows0 warnings

The Bank app box has a dashed border and bank app · 5 min; Approve goes on, dashed, and Decline runs back to Checkout, dashed and crossed.

Step 5: The end#

Give Order confirmed its route, then add an end of type success: the intended outcome was reached (17.2). Like every navigation exit from a view, the arrow from Order confirmed into the end needs a trigger, [Done] (13.5). -down-> puts the end under the view, as it did for the failure end.

Example 5Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout }action authorize { title: "Authorize payment"; description: "Asks the card issuer" }end refused { type: failure; description: "Card refused" }handoff bank_app { title: "Bank app"; description: "Approve the payment"; channel: bank app; timeout: 5 min }view confirmed { title: "Order confirmed"; route: /orders/:id }end paid { type: success; description: "Order paid" } from_cart --> checkoutcheckout --> authorize : [Pay] { payload: [card, amount] }authorize -down-x-> refused : card refusedauthorize --> bank_app : approval neededbank_app ..> confirmed : [Approve]bank_app .x.> checkout : [Decline]confirmed -down-> paid : [Done]@endujn
Drawing of Example 5: start from_cart, view Checkout, action Authorize payment, end refused, handoff Bank app, view Order confirmed, end paid. Arrows: from_cart to Checkout; Checkout to Authorize payment on Pay; Authorize payment to refused; Authorize payment to Bank app; Bank app to Order confirmed on Approve; Bank app to Checkout on Decline; Order confirmed to paid on Done.
Drawn from this text7 nodes · 7 arrows0 warnings

The journey now has both its ends: success under Order confirmed, failure under Authorize payment.

Step 6: Planned: Pay later#

Pay later is not built yet, so it gets the delivery flag future: planned for a later release (section 8). A flag never changes a shape: the border goes dotted, a tab shows the flag, and everything reachable only through Pay later inherits it; you never write an inherited flag. Flag the arrow into it too, so the Pay later button is marked as planned (13.8). Misspell it as futur and the module warns unknown flag futur.

Example 6Try it
@startujnjourney CHECKOUT "Checkout"description: "Pay by card and approve in the bank app. Pay later is planned." start from_cart { description: "From the cart" }view checkout { title: "Checkout"; description: "Address and card"; route: /checkout }action authorize { title: "Authorize payment"; description: "Asks the card issuer" }end refused { type: failure; description: "Card refused" }handoff bank_app { title: "Bank app"; description: "Approve the payment"; channel: bank app; timeout: 5 min }view confirmed { title: "Order confirmed"; route: /orders/:id }end paid { type: success; description: "Order paid" }view pay_later { title: "Pay later"; description: "Invoice in 30 days"; route: /checkout/later; flags: [future] } from_cart --> checkoutcheckout --> authorize : [Pay] { payload: [card, amount] }authorize -down-x-> refused : card refusedauthorize --> bank_app : approval neededbank_app ..> confirmed : [Approve]bank_app .x.> checkout : [Decline]confirmed -down-> paid : [Done]checkout -down-> pay_later : [Pay later] { flags: [future] }@endujn
Drawing of Example 6: start from_cart, view Checkout, action Authorize payment, end refused, handoff Bank app, view Order confirmed, end paid, view Pay later. Arrows: from_cart to Checkout; Checkout to Authorize payment on Pay; Authorize payment to refused; Authorize payment to Bank app; Bank app to Order confirmed on Approve; Bank app to Checkout on Decline; Order confirmed to paid on Done; Checkout to Pay later on Pay later.
Drawn from this text8 nodes · 8 arrows0 warnings

Pay later sits under Checkout with a dotted border and a flag tab, and the arrow into it is dotted with a tab of its own.

Next#

The home page's checkout has a few more lines than yours, mainly the call to the payment provider and its reply (14.5), trace links and a permanent id on Order confirmed (9.2, 7.1), and a Bank transfer page flagged legacy (section 8).

  • Recipes: complete journeys for common patterns: leaving the app and coming back, a form error and a retry, and marking steps as planned, idea or legacy.
  • The cheat sheet: one page with the nine kinds of node, the four kinds of arrow, the eleven flags and the most common warnings.
  • The spec: every rule in full. Arrows are in section 13, handoffs in section 15, and every warning is listed in section 21.