3PD - Loyalty Flow
%%{init: { "theme": "base", "themeVariables": { "fontSize": "18px", "background": "transparent", "actorBkg": "#038851", "actorTextColor": "#ffffff", "actorBorder": "#026139", "actorLineColor": "#94a3b8", "signalColor": "#64748b", "signalTextColor": "#059669", "noteBkgColor": "#e6f4ee", "noteTextColor": "#02502f", "noteBorderColor": "#038851", "activationBkgColor": "#c6ebdc", "activationBorderColor": "#026139", "sequenceNumberColor": "#ffffff", "labelBoxBkgColor": "#038851", "labelBoxBorderColor": "#026139", "labelTextColor": "#ffffff", "loopTextColor": "#059669" }, "sequence": { "useMaxWidth": true, "actorMargin": 70, "width": 150, "height": 60, "boxMargin": 12, "noteMargin": 14, "messageMargin": 50, "diagramMarginX": 20, "diagramMarginY": 20, "actorFontSize": 18, "actorFontWeight": 700, "noteFontSize": 15, "noteFontFamily": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", "messageFontSize": 16, "messageFontWeight": 700, "noteAlign": "left", "mirrorActors": false } }}%%
sequenceDiagram
participant C as Channel
participant D as Deliverect
participant L as Loyalty Partner
link L: GET Customer — full schema @ https://developers.deliverect.com/v3.0-ordering-experience/reference/loyalty_get_customer
link L: Loyalty Order Notification — full schema @ https://developers.deliverect.com/v3.0-ordering-experience/reference/loyalty-partner-order
link L: Cancel Loyalty Order — full schema @ https://developers.deliverect.com/v3.0-ordering-experience/reference/loyalty-partner-cancel-order
C->>D: Order with loyalty field value (checkout)
D->>L: GET Customer<br/>{loyaltyWebhookUrl}/?accountId={accountId}<br/>&loyaltyProfileId={loyaltyProfileId}<br/>&providerId={providerId}<br/>&locationId={locationId}<br/>&channelLinkId={channelLinkId}
Note over L: providerId = value entered at checkout<br/>(phone, email or loyalty membership ID, URL-encoded)<br/><br/>Expected response:<br/>200 → customer exists: return loyalty profile JSON<br/>#nbsp;#nbsp;#nbsp;#nbsp;#nbsp;#nbsp;required: providerId, status, acceptedTCAt<br/>#nbsp;#nbsp;#nbsp;#nbsp;#nbsp;#nbsp;+ email / phoneNumber if used as identifier<br/>404 → customer not found
alt
L-->>D: 200 — Customer exists
Note over D,L: {<br/>#nbsp;#nbsp;"providerId": "partner-customer-id-1234",<br/>#nbsp;#nbsp;"firstName": "John",<br/>#nbsp;#nbsp;"lastName": "Doe",<br/>#nbsp;#nbsp;"email": "[email protected]",<br/>#nbsp;#nbsp;"phoneNumber": "+32111111111",<br/>#nbsp;#nbsp;...<br/>}<br/>Full schema: developers.deliverect.com → GET Customer
D->>L: POST {loyaltyWebhookUrl}/loyalty/order (complete loyalty order)
Note over D,L: {<br/>#nbsp;#nbsp;"orderId": "63********************a7",<br/>#nbsp;#nbsp;"channelOrderDisplayId": "TESTORDER1",<br/>#nbsp;#nbsp;"accountId": "{accountId}",<br/>#nbsp;#nbsp;"locationId": "{locationId}",<br/>#nbsp;#nbsp;"channelLinkId": "{channelLinkId}",<br/>#nbsp;#nbsp;"customer": { ... },<br/>#nbsp;#nbsp;"items": [ ... ],<br/>#nbsp;#nbsp;"paymentAmount": 2450,<br/>#nbsp;#nbsp;...<br/>}<br/>Full schema: developers.deliverect.com → Loyalty Order Notification
else
L-->>D: 404 — Customer not found
Note over D: no loyalty order sent
end
rect rgba(148, 163, 184, 0.12)
opt ONLY IF the order is cancelled after placement
C->>D: Order cancelled
D->>L: POST {loyaltyWebhookUrl}/loyalty/cancelOrder (customer + cancelled order)
Note over D,L: {<br/>#nbsp;#nbsp;"orderId": "63********************a7",<br/>#nbsp;#nbsp;"channelOrderDisplayId": "TESTORDER1",<br/>#nbsp;#nbsp;"isCancelled": true,<br/>#nbsp;#nbsp;"cancellationReason": "Customer cancelled.",<br/>#nbsp;#nbsp;"customer": {<br/>#nbsp;#nbsp;#nbsp;#nbsp;"email": "[email protected]",<br/>#nbsp;#nbsp;#nbsp;#nbsp;"phoneNumber": "+32111111111",<br/>#nbsp;#nbsp;#nbsp;#nbsp;...<br/>#nbsp;#nbsp;},<br/>#nbsp;#nbsp;...<br/>}<br/>Full schema: developers.deliverect.com → Cancel Loyalty Order
Note over L: reverse any accumulated points
end
end