Create a Token - Diagram


PlatformsRole
ChannelThe ordering platform integrating with Deliverect Pay Dpay. Initiates the tokenization and payment requests.
BasisTheory ProxyToken vault proxy. Receives PCI data from the channel, encrypts it, and forwards it to Dpay.
Deliverect Pay (Dpay)Deliverect's payment orchestration layer. Manages tokens, verification, and fund acquisition.
PSPThe underlying Payment Service Provider that verifies cards and acquires funds.

%%{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
    participant CHANNEL as Channel
    participant PROXY as BasisTheory Proxy
    participant DPAY as Deliverect Pay
    participant PSP as PSP
    Note over CHANNEL,PSP: ๐Ÿญ โ€” ๐—ง๐—ผ๐—ธ๐—ฒ๐—ป๐—ถ๐˜‡๐—ฒ ๐—ฎ ๐—ฐ๐—ฎ๐—ฟ๐—ฑ<br/>โ„น๏ธ Deliverect uses BasisTheory as a token vault, surfacing a proxy<br/>to channels. The proxy securely receives PCI data and passes<br/>encrypted data to the PSP. Custom hostname:<br/>https://basistheory.staging.deliverect.com
    CHANNEL->>+PROXY: create token
    Note right of CHANNEL: POST https://basistheory.staging.deliverect.com<br/>{<br/>#160;#160;"gatewayProfileId": "gateway-1",<br/>#160;#160;"channelLinkId": "channelLink-1",<br/>#160;#160;"customerId": "customer-1",<br/>#160;#160;"payment_method": {<br/>#160;#160;#160;#160;"number": "4111111111111111",<br/>#160;#160;#160;#160;"expiration_month": 3,<br/>#160;#160;#160;#160;"expiration_year": 2030,<br/>#160;#160;#160;#160;"cvc": "737"<br/>#160;#160;}<br/>}
    PROXY->>+DPAY: create token
    DPAY->>+PSP: verify card
    PSP-->>-DPAY: Result
    DPAY-->>-CHANNEL: Token
    deactivate PROXY
    Note right of CHANNEL: 200 OK<br/>{<br/>#160;#160;"id": "token-1",<br/>#160;#160;"accountId": "account-1",<br/>#160;#160;"customerId": "customer-1",<br/>#160;#160;"card": {<br/>#160;#160;#160;#160;"brand": "visa",<br/>#160;#160;#160;#160;"last4": 1234,<br/>#160;#160;#160;#160;"expirationYear": 2030,<br/>#160;#160;#160;#160;"expirationMonth": 10<br/>#160;#160;},<br/>#160;#160;"provider": "basis_theory",<br/>#160;#160;"providerId": "provider-id",<br/>#160;#160;"status": "verified | failed",<br/>#160;#160;"verification": {<br/>#160;#160;#160;#160;"paymentId": "payment-1",<br/>#160;#160;#160;#160;"providerTokenIntentId": "token-intent-1"<br/>#160;#160;},<br/>#160;#160;"gateway": 1234,<br/>#160;#160;"paymentGatewayToken": "gateway-token"<br/>}
    Note over CHANNEL,PSP: ๐Ÿฎ โ€” ๐—Ÿ๐—ถ๐˜€๐˜ ๐—ฐ๐˜‚๐˜€๐˜๐—ผ๐—บ๐—ฒ๐—ฟ ๐˜๐—ผ๐—ธ๐—ฒ๐—ป๐˜€<br/>โ„น๏ธ A customer may have multiple tokenized cards. An endpoint lists<br/>these tokens, allowing the customer to choose the card they<br/>want to use for payment.<br/>The customerId is the one sent when creating the token.
    CHANNEL->>+DPAY: list customer tokens
    Note right of CHANNEL: GET /pay/channel/{channelLinkId}/tokens/customer/{customerId}
    DPAY-->>-CHANNEL: Tokens
    Note right of CHANNEL: 200 OK<br/>{<br/>#160;#160;"total": 1,<br/>#160;#160;"page": 1,<br/>#160;#160;"size": 50,<br/>#160;#160;"items": [<br/>#160;#160;#160;#160;{<br/>#160;#160;#160;#160;#160;#160;"id": "token-1",<br/>#160;#160;#160;#160;#160;#160;"accountId": "account-1",<br/>#160;#160;#160;#160;#160;#160;"customerId": "customer-1",<br/>#160;#160;#160;#160;#160;#160;...<br/>#160;#160;#160;#160;}<br/>#160;#160;]<br/>}
    Note over CHANNEL,PSP: ๐Ÿฏ โ€” ๐—ฅ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜ ๐—ฎ ๐—ฝ๐—ฎ๐˜†๐—บ๐—ฒ๐—ป๐˜ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—ฎ ๐˜๐—ผ๐—ธ๐—ฒ๐—ป<br/>โ„น๏ธ Deliverect Pay surfaces an endpoint for channels to request a payment.<br/>It supports various modes, one being "token", where a verified<br/>token acquires funds. Capture modes:<br/>ยท immediate โ€” capture funds instantly (default)<br/>ยท manual โ€” pre-authorize now, capture later
    CHANNEL->>+DPAY: request payment
    Note right of CHANNEL: POST /pay/channel/{channelLinkId}/payments/request<br/>{<br/>#160;#160;"gatewayProfileId": "gateway-1",<br/>#160;#160;"mode": {<br/>#160;#160;#160;#160;"type": "token",<br/>#160;#160;#160;#160;"tokenId": "token-1"<br/>#160;#160;},<br/>#160;#160;"captureMode": "immediate",<br/>#160;#160;"amount": 1000,<br/>#160;#160;"currency": "USD",<br/>#160;#160;"payer": {<br/>#160;#160;#160;#160;"name": "John Doe",<br/>#160;#160;#160;#160;"reference": "customer-1"<br/>#160;#160;}<br/>}
    DPAY->>+PSP: acquire
    PSP-->>-DPAY: Result
    DPAY-->>-CHANNEL: Payment
    Note right of CHANNEL: 200 OK<br/>{<br/>#160;#160;"paymentId": "payment-1",<br/>#160;#160;"paymentStatus": "authorized"<br/>}