Fires after a post-checkout intake answer disqualifies a patient on an already-paid ecommerce order and the automatic unwind completes (or fails). TelegraMD cancels any linked subscription, refunds or voids payment depending on capture state, cancels the ecommerce and clinical orders, and writes system notes. The eventType is post_purchase_disqualification_processed. Categories: COMMERCE, PAYMENT, ORDER.
v2 payloads are notification-only. v1eventDatacarries full orchestration detail (branch,failed,subscription_cancelled,clinical_order_id,note_id,disqualifiers, etc.), but most of those fields are not on the v2 allowlist and are stripped at delivery. v2 delivers commerce/order identifiers andrefund_amount_centswhen applicable — fetch order or ecommerce order detail via the API for full context: use the authenticated GET /ecommerce/orders/:id endpoint for the ecommerce order (ecommerce_order_id/order_id) and GET /orders/:id for the linked clinical order when present.
Field guarantees
| Field | Guarantee |
|---|---|
ecommerce_order_id, commerce_status | ✅ Always present — v1: read from targetEntity (EcommerceOrder); v2: top-level fields from the sanitizer |
order_id | ✅ Always present in v1 eventData — the ecommerce order id (same entity as ecommerce_order_id) |
refund_amount_cents | ⚠️ Conditional — successful refund branch only; absent on void and when a refund attempt fails |
| Orchestration detail in v1 | ✅ branch, failed, subscription_cancelled, clinical_order_id, clinical_order_cancelled, note_id, clinical_note_id, disqualifiers on success; failure path includes error |
| Orchestration detail in v2 | ⛔ Stripped — not on category allowlists |
v1 payload (legacy) — success
{
"ownerEntityModel": "Patient",
"targetEntityModel": "EcommerceOrder",
"eventType": "post_purchase_disqualification_processed",
"eventTitle": "Post-purchase disqualification processed",
"eventData": {
"branch": "refund",
"failed": false,
"subscription_cancelled": true,
"refund_amount_cents": 4999,
"order_id": "eord::example",
"clinical_order_id": "ord::example",
"clinical_order_cancelled": true,
"note_id": "note::example",
"clinical_note_id": "note::clinical-example",
"disqualifiers": [{ "questionId": "qi::example", "answerValue": "yes" }]
},
"targetEntity": "eord::example",
"ownerEntity": "pat::example",
"id": "event::example"
}v1 payload (legacy) — failure
When orchestration fails partway through, a failure event is emitted with failed: true and an error string. A SystemError is also recorded on the ecommerce order (and clinical order when linked).
{
"eventType": "post_purchase_disqualification_processed",
"eventTitle": "Post-purchase disqualification processing failed",
"targetEntityModel": "EcommerceOrder",
"eventData": {
"branch": "refund",
"failed": true,
"subscription_cancelled": true,
"order_id": "eord::example",
"error": "Refund failed: charge already refunded",
"disqualifiers": [{ "questionId": "qi::example", "answerValue": "yes" }]
},
"targetEntity": "eord::example"
}eventData field | Type | Always? | Notes |
|---|---|---|---|
branch | string | ✅ | "refund" or "void" — depends on whether payment was captured |
failed | boolean | ✅ | false on success, true on orchestration failure |
subscription_cancelled | boolean | ✅ | Whether subscription cancellation succeeded |
refund_amount_cents | number | ⚠️ | Refund branch only — present on successful refund; optional when a refund attempt fails |
order_id | string | ✅ | Ecommerce order id |
clinical_order_id | string | null | ⚠️ | Linked clinical order id when present |
note_id, clinical_note_id | string | null | ⚠️ | System note ids when notes were written |
disqualifiers | array | ✅ | Audit context for which answers triggered disqualification |
error | string | ⚠️ | Failure path only |
v2 payload
Sanitized envelope. Only allowlisted commerce/order fields survive.
{
"event_type": "post_purchase_disqualification_processed",
"event_id": "event::example",
"api_version": "2026-08-09",
"timestamp": "2026-05-30T14:00:00.000Z",
"affiliate_id": "aff::example",
"patient_id": "pat::example",
"patient_external_id": "ext-patient-123",
"patient_marketing_consent": true,
"is_returning_patient": false,
"ecommerce_order_id": "eord::example",
"commerce_status": "cancelled",
"order_id": "eord::example",
"refund_amount_cents": 4999
}| Field | Delivered in v2 | Notes |
|---|---|---|
| Envelope + patient identity | ✅ | |
ecommerce_order_id, commerce_status | ✅ | From target ecommerce order |
order_id | ✅ | Ecommerce order id from eventData |
refund_amount_cents | ⚠️ | Refund branch only — present on successful refund; absent when a refund attempt fails |
branch, failed, subscription_cancelled, clinical/note ids, disqualifiers | ⛔ | v1 only — use API for detail |
