Preview This feature is for preview only and is subject to change. # Pay via AI Agent (Delegate token) Enterprise ## How to enable After receiving the delegate token from the agent (e.g. ChatGPT) apply it in the Payments API request by setting: * `instruction.method` to `card` * `instruction.paymentInstrument.type` to `delegate`. ### Delegate token ```json { "transactionReference": "order1234", "merchant": { "entity": "default" }, "instruction": { "method": "card", // [!code focus:5] // [!code highlight:5] "paymentInstrument": { "type": "delegate", "sessionHref": "https://try.access.worldpay.com/sessions/eyJrIjoxLCJkIjoialRBL0FFelBzcnZpNCtzRGNRemh0NzI0NE1rdUtjMUFJdjYxVnlibWZuUT0ifQ" }, "customer": { "email": "john.appleseed@example.com", "phone": "00000000000", "ipAddress": "192.168.0.1" }, "narrative": { "line1": "trading name" }, "value": { "currency": "GBP", "amount": 42 } } } ``` ### Feature limitations The delegate token flow is currently restricted to guest card payments. 3DS, SCA Exemptions and Worldpay token creation are not available. ## Diagram: Pay via AI Agent (OpenAI) ```mermaid sequenceDiagram participant Agent participant Merchant participant Sessions as Worldpay Delegate Tokens API participant PAPI as Worldpay Payments API Agent->>+Merchant: POST to /checkout_sessions Merchant-->>-Agent: Return PSP information inc. checkoutId Agent->>+Sessions: POST to /agentic_commerce/delegate_payment Sessions->>Sessions: Store delegate payment data Sessions-->>-Agent: Return session href Agent->>+Merchant: POST to /checkout_sessions/{id}/complete {payment_data:href} Merchant->>+PAPI: POST to /api/payments {instruction.paymentInstrument.sessionHref} PAPI->>+Sessions: GET {sessionHref} Sessions->>Sessions: Lookup session Sessions-->>-PAPI: Return delegate payment data PAPI->>PAPI: Validate delegate payment data against instruction opt : if valid PAPI->>PAPI: authorize payment end PAPI-->>-Merchant: Return payment outcome Merchant-->>-Agent: Return payment outcome ```