---
title: "Let agents buy through the same order flow · Agent Wranglers"
url: https://agentwranglers.se/playbook/usage-billing/agentic-payments/agent-checkout
id: USG-23
level: Optional
applies: payments
updated: 2026-10-22
tokens: 849
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Let agents buy through the same order flow as people

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Agentic payments](https://agentwranglers.se/playbook/usage-billing/agentic-payments.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: USG-23
- Level: Optional
- Chapter: [Agentic payments](https://agentwranglers.se/playbook/usage-billing/agentic-payments.md)
- Rule: If you open checkout to AI agents, run their orders through the same order, price, tax and fraud code as the web checkout. Charge their payment tokens through your provider.
- Check: A test sends an order through the agent endpoint and one through the web checkout with the same cart. Both produce the same total, tax and order states. A payment token used a second time is refused.
- Applies when: The project takes payments.
- How: In ACP and similar flows, the agent sends a cart and a payment token that the buyer's wallet or provider issued. The token is limited to one merchant, an amount and an expiry date. You stay the seller, so the prices, refunds and consumer rights in the [payments playbook](https://agentwranglers.se/playbook/payments.md) all still apply. Create the order with [Freeze what the customer agreed to on the order](https://agentwranglers.se/playbook/payments/amounts-and-orders/order-snapshot.md) and charge it with an idempotency key. Mark agent orders, so you can watch their refund and dispute rates apart from the rest.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
export async function createAgentOrder(request) {
  const order = await orders.createFromCart(request.cart, { channel: 'agent', agent: request.agentId })
  await payments.chargeToken(order, request.paymentToken, { idempotencyKey: `order-${order.id}` })
  return order
}
```

### Python example

```python
def create_agent_order(request):
    order = orders.create_from_cart(request.cart, channel="agent", agent=request.agent_id)
    payments.charge_token(order, request.payment_token, idempotency_key=f"order-{order.id}")
    return order
```

## Sources

- [Agentic Commerce Protocol](https://www.agenticcommerce.dev/)

## Related rules

- PAY-12 [Freeze what the customer agreed to on the order](https://agentwranglers.se/playbook/payments/amounts-and-orders/order-snapshot.md) in Payments and billing

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/usage-billing/agentic-payments/agent-checkout">Agent Wranglers usage-based billing playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Track the agent payment protocols before you build on one](https://agentwranglers.se/playbook/usage-billing/agentic-payments/agent-payment-protocols.md)
- Next: [Verify an HTTP 402 payment before doing the work](https://agentwranglers.se/playbook/usage-billing/agentic-payments/http-402-payments.md)
- [Agentic payments](https://agentwranglers.se/playbook/usage-billing/agentic-payments.md)
