com.atiproto.payment.cart.checkout
procedurecom.atiprotoCheck out an existing cart. The cart record already carries subject, items, currency, and total; this procedure only needs the cart uri. When a `broker` is pre-seeded, the PoS runs the broker's `network.attested.payment.initiate` (today via outbound workflow, in the future direct) and the response carries `checkoutUrl` plus a strongRef `payment`. When no broker is pre-seeded, `payment` carries an `#initiateRequest` shape the caller can use to invoke a broker themselves. Callers inspect `$type` on `payment` to discriminate the two cases.
Input
| Name | Type | Required | Description |
|---|---|---|---|
| cart | string (at-uri) | required | URI of the existing cart to check out. |
| broker | string (did) | optional | Optional. did:web of a single broker to route initiate through. When omitted, the response's `payment` carries the unfilled initiate request instead of a strongRef. |
| redirectUrl | string (uri) | optional | URI the processor should redirect to after checkout completion or cancellation. Used when a broker is provided. |
| workflow | com.atiproto.actions#inboundWorkflow | optional | Workflow callback envelope carrying the broker's `network.attested.payment.initiate` response. Present only on agent-driven callbacks. |
Output
| Name | Type | Required | Description |
|---|---|---|---|
| workflow | com.atiproto.actions#outboundWorkflow | optional | Workflow envelope. When present, the agent runs the actions (typically a single call to `network.attested.payment.initiate`) and calls back. When absent, this is the final native result. |
| checkoutUrl | string (uri) | optional | Processor-hosted checkout URL. Present only when a `broker` was provided and initiate succeeded. |
| payment | union | required | Either a `com.atproto.repo.strongRef` to the newly created `network.attested.payment` record (when a broker was provided and initiate completed) or an `#initiateRequest` shape mirroring `network.attested.payment.initiate` input (when no broker was provided; the caller routes to a broker themselves). Callers discriminate by `$type`. |
Type: initiateRequest
| Name | Type | Required | Description |
|---|---|---|---|
| subject | string (did) | required | DID of the payment recipient (mirrors the cart's subject). |
| items | array<network.attested.payment.initiate#oneTime | network.attested.payment.initiate#recurring> | required | Line items derived from the cart, ready to forward to a broker's `network.attested.payment.initiate`. |
| redirectUrl | string (uri) | optional | URI the processor should redirect to after checkout completion or cancellation, when the caller is ready to provide one. |
Usage Example
typescript
import { Agent } from "@atiproto/agent";// Create a TipAgent from any XrpcClientconst paymentAgent = new Agent(authenticatedClient);// Call checkoutconst response = await paymentAgent.com.atiproto.payment.cart.checkout({cart: "at://did:plc:example123/com.example.post/abc"});// response.data → {// payment: { ... }// }