%%{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" }, "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
autonumber
actor Customer
participant Channel Platform
participant Deliverect Pay
participant PSP
Note over Channel Platform,Deliverect Pay: 1. Get payment gateways
Channel Platform->>Deliverect Pay: GET gatewayProfiles for channelLinkId
Deliverect Pay-->>Channel Platform: 200 OK with online gatewayProfileId list
Note over Channel Platform,PSP: 2. Create token optional for token mode
Note right of Channel Platform: See Create Token flow first. Channel already has a verified tokenId.
Note over Customer,PSP: 3. Request payment token mode
Customer->>Channel Platform: Pays with saved card
Channel Platform->>Deliverect Pay: POST payments request mode type token and tokenId
Deliverect Pay->>PSP: Acquire or preauthorize funds
PSP-->>Deliverect Pay: Result
Deliverect Pay-->>Channel Platform: 200 OK with paymentId and paymentStatus
Note over Customer,PSP: 4. Request payment redirect mode
Customer->>Channel Platform: Chooses online payment
Channel Platform->>Deliverect Pay: POST payments request mode type redirect and returnUrl
Deliverect Pay->>PSP: Create payment session
PSP-->>Deliverect Pay: Redirect URL
Deliverect Pay-->>Channel Platform: 200 OK pending with redirect action url
Channel Platform->>Customer: Redirect to PSP checkout
Customer->>PSP: Completes payment on PSP
Note over Channel Platform,PSP: 5. Payment status updates
PSP->>Deliverect Pay: POST payment events payment_update authorized or refused
Deliverect Pay->>Channel Platform: POST payment update webhook URL with paymentId and status
Channel Platform-->>Deliverect Pay: 200 OK
Note right of Channel Platform: Or poll GET payment by paymentId
Note over Channel Platform,PSP: 6. Refund optional
Channel Platform->>Deliverect Pay: POST payments refund with amount
Deliverect Pay->>PSP: Process refund
PSP-->>Deliverect Pay: Result
PSP->>Deliverect Pay: POST payment events refund_update
Deliverect Pay-->>Channel Platform: 200 OK