> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentcard.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Agentcard is for companies whose agent buys for their users. Pick one path: the opencommerce SDK (@agent-cards/commerce-sdk) gives your agent one buy tool that finds the product, builds the cart, gets the user's approval and places the order at real stores; the Agentcard SDK (@agent-cards/sdk) pays with the user's own card when your agent already shops in a browser (Browser Use, Kernel, Browserbase, Anchor or Notte); the Purchase API (POST /buy) does the same purchase flow over plain HTTP in any language; Issuing gives the agent its own card.
> Start with `npx agent-cards init` in the app's folder (Node 22 or later). No invite is needed: it creates your Agentcard account if you don't have one, installs the opencommerce SDK and puts the credentials in the env file, kept out of git. From a coding agent, run `npx agent-cards init --print --categories all --implementation tool --wallet vault --skip-install` to get the setup steps to apply yourself.
> Vault is by invitation: request it at https://agentcard.com/get-started?utm_source=docs&utm_medium=llms&utm_campaign=agent-instructions. opencommerce needs no invite.
> Never ask a user for a card number, expiry date or CVV in chat. Send them the Vault link; they add their card on Agentcard's page, and the agent never sees the number.
> Every purchase is approved by the user, with a passkey or Face ID, or by an auto-approval they granted. An approval covers one merchant and one exact total. If the total changes, ask again. When a result says the user already said yes, don't ask again.
> `init` writes PRODUCTION credentials, which place real orders, so test in sandbox first. For opencommerce, run `npx agent-cards credentials --mode sandbox` and put the two lines it prints in place of the production ones in the env file `init` wrote, because that command only prints them; sandbox then runs the whole flow against real stores and stops before payment, so no order is placed and nobody is charged. For Vault and Issuing, sandbox credentials issue test cards that no real merchant accepts; try the checkout against shop.agentcard.sh, a test store on Stripe test mode.
> Tell the user an order is placed only after Agentcard reports it placed.
> Vault is free up to 5,000 users (https://agentcard.com/pricing). opencommerce takes 1% of each completed order. Full docs in one file: https://docs.agentcard.com/llms-full.txt

# start_return

> Return a placed order, in two calls: a quote, then a confirm.

Connect to `https://mcp.opencommerce.sh/mcp` with your Commerce SDK credentials as `Authorization: Bearer <YOUR_CLIENT_ID>:<YOUR_CLIENT_SECRET>`. See [Connect your agent](https://docs.agentcard.com/commerce-mcp/implement.md#connect-a-client).

> [!NOTE]
>
> `start_return` isn't available on the server yet. Until it is, a call answers `order_actions_unavailable`.

Behavior: Changes state on the second call only. The quote changes nothing and can be asked again. Never resend the confirm.

## What it does

Returns a whole placed order in two calls. The first call, without `confirm_token`, returns a quote with the refund, the card it goes back to, a `confirm_token`, and its `expires_at`, and changes nothing. Show the shopper the refund and ask.

Only after the shopper says yes to that quote, call again with the same `reason` and the quote's `confirm_token`. That opens the return once and answers `return_id`. The labels and the refund come later: read them with [`get_return`](https://docs.agentcard.com/commerce-mcp/tools/get_return).

## Inputs

| Field | Type | Description |
| - | - | - |
| `shopper_id` *(required)* | string | Your own stable id for the shopper. The same value on every call for the same person. |
| `order_id` *(required)* | string | The order's id, from a `buy` result, `get_conversation`, or an order update. |
| `reason` *(required)* | enum | Why the shopper sends it back, in their words mapped to one of the reasons listed under Notes. |
| `notes` | string | Anything else the shopper said about the problem, as they said it. 1 to 1000 characters. |
| `confirm_token` | string | The `confirm_token` from this order's quote, only after the shopper said yes to that quote. Leave it out to get the quote. |
| `merchant` | string | Only when the error is `order_id_ambiguous`: one of the stores the error names. |

## Returns

| Field | Type | Description |
| - | - | - |
| `order_id` | string | The order's id. |
| `action` | string | `cancel` or `return`. |
| `stage` | string | `quote`: nothing changed yet, so show the shopper the refund and ask. `confirmed`: the store has the request. |
| `refund` | object or null | `{ amount_cents, currency }`: what goes back to the shopper. |
| `refund_to` | object or null | `{ brand, last4 }`: the card the refund goes back to. `null` when the order was paid from a balance. |
| `items` | array of strings | The order lines the action covers. Empty for the whole order. |
| `confirm_token` | string or null | On a quote: pass it back with the shopper's yes. It acts once. |
| `expires_at` | string or null | On a quote: the time the token stops working. |
| `state` | string or null | Once confirmed. For a cancel: `canceled`, or `requested` while the store hasn't confirmed. For a return: `requested`, `label_ready`, `denied`, or `refunded`. |
| `return_id` | string or null | A confirmed return's id, for `get_return`. |

## Example calls

Ask for the quote:

```json theme={null}
{
  "tool": "start_return",
  "arguments": {
    "shopper_id": "user_8f3a21",
    "order_id": "<ORDER_ID>",
    "reason": "damaged",
    "notes": "The box arrived crushed."
  }
}
```

After the shopper says yes to the quote, send the same call with its token:

```json theme={null}
{
  "tool": "start_return",
  "arguments": {
    "shopper_id": "user_8f3a21",
    "order_id": "<ORDER_ID>",
    "reason": "damaged",
    "notes": "The box arrived crushed.",
    "confirm_token": "<CONFIRM_TOKEN>"
  }
}
```

## Notes

* `reason` is one of `damaged`, `not_delivered`, `empty_box`, `wrong_item`, `defective`, `not_as_described`, `wrong_size`, `no_longer_needed`, or `other`.
* If the confirming call's result is uncertain, call [`get_order`](https://docs.agentcard.com/commerce-mcp/tools/get_order) to see whether it went through. Never resend it.
* `return_not_supported` means the store doesn't take returns for this order. Tell the shopper the reason and the next step the message names.
* `order_actions_unavailable` means returning isn't available yet. Tell the shopper to contact the store, or check the order with `get_order`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.