What you’ll do
1
Act on the one trouble event: cancellation
prescription.cancelled (data.status cancelled) is the only prescription event that means trouble.2
Treat a cancellation as the whole signal
There is no structured reason field:
type prescription.cancelled + data.status cancelled +
data.timestamps.cancelled_at is all you get.3
Read payment trouble from the billing events
On-hold and unpaid states are not on prescription events, and a refund request appears only as
prescription.refund_requested at 2.0. Read payment state from the billing events or the
payment pages.4
Run your own stale sweep
There is no order list to poll. “No event for N days” on your own clock is the only stuck
signal you have.
5
Escalate with the resource_id and the last envelope id
These are what make an escalation actionable when there is no API response to quote.
Recipe · Spot the values that mean trouble
Only one prescription event means trouble: a cancellation. Every event carries the order’s currentdata.status (created, ordered, shipped, delivered, cancelled, unknown); check it on every
event you apply.
Payment trouble is not on prescription events. There is no on-hold or payment-failure field on a
prescription payload.
prescription.invoiced, .paid and .refund_requested arrive only on a 2.0
subscription and say that billing moved, not why a payment failed. Detect payment
trouble from the com.openloop.payments events or the payment reads — see Payment failure.
data.context is a free-form string → string map whose keys are not part of the versioned
contract; do not route on a specific context key.
Recipe · Handle a cancellation
prescription.cancelled sets data.status to cancelled and data.timestamps.cancelled_at. There is
no structured cancellation-reason field in the deployed contract — the event does not tell you why
the order was cancelled.
So a cancellation is a single fact: the order is cancelled, as of cancelled_at. Stop showing shipment
progress as the headline and show it as cancelled. If the patient did not ask for the cancellation,
escalate it with the ids below; the “why” has to come from your implementation contact, not the event.
Billing is a separate lifecycle. A cancelled order does not by itself cancel a subscription or
refund an invoice; that is Cancel, pause and refund. Refund and payment state live on the billing
events, not on the prescription event — see Payment failure.
Recipe · Sweep for orders that have gone quiet
There is no order list on the partner surface, so you cannot ask OpenLoop which orders are stuck. Your own record of the events you received is the sweep’s input, and your own clock is its trigger. Keep, per order (data.resource_id): the last type, the last occurredAt, and the time you
received it. On a schedule, flag every order whose last event is older than your threshold for that
stage and that has not reached a terminal state (data.status of shipped or cancelled):
The thresholds are yours; the contract gives none. Two cases the per-order sweep cannot
see, because no event exists to start the clock:
- The order never appeared. You took payment or submitted an intake and no
prescription.createdhas arrived. Start that clock from your own submit time. No prescription event signals that a clinician declined to prescribe, so silence is all you will see. - Events stopped arriving for everyone. If no event at all has reached your endpoint for longer than your usual traffic gap, suspect the delivery path before suspecting every order. The signature, retry and delivery policy are the standard webhook contract — see Events; a delivery that exhausts its retries is recorded as failed and is not re-sent automatically (an OpenLoop operator can re-drive it).
2xx for
the events you did receive, and that an event was not dropped by your dedupe on the envelope id or
filed under the wrong patient (see the correlation rule on Order status and tracking).
Recipe · Escalate
When an order is genuinely stuck, or cancelled without the patient asking, send your implementation contact:- The
data.resource_idfrom the event — your order key. - The envelope
idandtypeof the last event you received for it, with itsoccurredAt. - The
data.pharmacyidentifier if it is set, labelled as the dispensing pharmacy. - What you expected to happen and by when, on your clock.
request_id to quote; the envelope id plays that role.
Capture it from the event you actually stored, not from a later one.
What comes back
The full attribute set is on Prescription events.
Gotchas
Webhook events cannot be exercised by the conformance runner, and this cookbook has not observed a
cancellation on staging. The envelope, fields and status values are the deployed contract (see
Events and Prescription events); the routing guidance here is this cookbook’s, not
documented behaviour.
Related
Order status and tracking
The happy path this page interrupts: set-up, rendering status, dedupe and correlation
Prescription events
Every attribute and value, the status enum and the timestamps
Cancel, pause and refund
When the answer to a problem order is to stop billing for it or refund it
Payment failure
When an order is on hold because the payment did not go through

