---
title: codespar_checkout
description: Sell-side merchant checkout — as a merchant, create and process a checkout for a shopper to pay you. Routes to Stripe ACP, Asaas, or x402 by payment method. Call via session.execute().
---

import { Callout } from "fumadocs-ui/components/callout";
import { Tabs, Tab } from "fumadocs-ui/components/tabs";

# codespar_checkout

<Callout title="Meta-tool" type="info">
`codespar_checkout` is the **sell-side** primitive: as a merchant, you create and process a checkout for a shopper to pay **you**. It handles cart, pricing, tax, and payment, and routes to the right rail from `paymentMethod`. Use [`codespar_shop`](/docs/concepts/meta-tools/shop) when the agent is the **buyer** shopping a store. Use [`codespar_charge`](/docs/concepts/meta-tools/charge) for a bare inbound charge, and [`codespar_pay`](/docs/concepts/meta-tools/pay) for an outbound transfer.
</Callout>

## Rails

The rail is selected from `paymentMethod`:

| `paymentMethod` | Routes to | Notes |
|---|---|---|
| `card` | Stripe ACP | Agentic Commerce Protocol hosted checkout |
| `pix` | Asaas | BRL, instant settlement |
| `boleto` | Asaas | BR bank slip |
| `usdc` | x402 (testnet) | On-chain micropayment settlement, routed via `codespar_crypto_pay`. Testnet today |

## Direct execute

There is no typed wrapper for `codespar_checkout` yet — call via `session.execute()`.

<Tabs items={["TypeScript", "Python"]}>

```ts tab="TypeScript"
const order = await session.execute("codespar_checkout", {
  items: [{ name: "Tênis Masculino", quantity: 1 }],
  paymentMethod: "pix",
  currency: "BRL",
  recipient: "shopper@example.com",
});
console.log(order.tool_call_id, order.status);
```

```python tab="Python"
order = session.execute("codespar_checkout", {
    "items": [{"name": "Tênis Masculino", "quantity": 1}],
    "paymentMethod": "pix",
    "currency": "BRL",
    "recipient": "shopper@example.com",
})
print(order["tool_call_id"], order["status"])
```

</Tabs>

## Args shape

| Field | Type | Required | Description |
|---|---|---|---|
| `items` | `array` | Yes | Items in the checkout |
| `paymentMethod` | `string` | No | `card` \| `pix` \| `boleto` \| `usdc` |
| `currency` | `string` | No | Currency code (e.g. `BRL`, `USD`) |
| `recipient` | `string` | No | Shopper identifier (who pays the merchant) |

## Result

Returns a `tool_call_id` plus the resolved payment `rail`. Card and Pix
settle asynchronously — correlate completion with
[`session.paymentStatus()`](/docs/api/sdk#paymentstatustoolcallid-promisepaymentstatusresult)
just like [`codespar_charge`](/docs/concepts/meta-tools/charge).

## See also

- [codespar_shop](/docs/concepts/meta-tools/shop) — buy-side: the agent is the shopper buying from a store
- [codespar_charge](/docs/concepts/meta-tools/charge) — collect a bare inbound payment as the merchant
- [codespar_pay](/docs/concepts/meta-tools/pay) — bare outbound transfer
- [E-Commerce Checkout cookbook](/docs/cookbooks/ecommerce-checkout) — cart → checkout → fulfillment
- [Tools & meta-tools](/docs/concepts/tools) — full meta-tool list
