com.atiproto.payment.cart.checkout

procedurecom.atiproto

Check 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

NameTypeRequiredDescription
cartstring (at-uri)requiredURI of the existing cart to check out.
brokerstring (did)optionalOptional. 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.
redirectUrlstring (uri)optionalURI the processor should redirect to after checkout completion or cancellation. Used when a broker is provided.
workflowcom.atiproto.actions#inboundWorkflowoptionalWorkflow callback envelope carrying the broker's `network.attested.payment.initiate` response. Present only on agent-driven callbacks.

Output

NameTypeRequiredDescription
workflowcom.atiproto.actions#outboundWorkflowoptionalWorkflow 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.
checkoutUrlstring (uri)optionalProcessor-hosted checkout URL. Present only when a `broker` was provided and initiate succeeded.
paymentunionrequiredEither 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

NameTypeRequiredDescription
subjectstring (did)requiredDID of the payment recipient (mirrors the cart's subject).
itemsarray<network.attested.payment.initiate#oneTime | network.attested.payment.initiate#recurring>requiredLine items derived from the cart, ready to forward to a broker's `network.attested.payment.initiate`.
redirectUrlstring (uri)optionalURI 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 XrpcClient
const paymentAgent = new Agent(authenticatedClient);
// Call checkout
const response = await paymentAgent.com.atiproto.payment.cart.checkout({
cart: "at://did:plc:example123/com.example.post/abc"
});
// response.data → {
// payment: { ... }
// }