> ## 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

# Confirm a collection

> Say whether you collected from your customer, so a transfer goes on to the card or stops.

If your company collects from its own customer before Agentcard funds a card,
each transfer waits on you: `card_flow.started` arrives with
`ack_required: true`. Collect, then send the outcome before
`collection_deadline`. `succeeded` lets the transfer go on to the card, and
the agent's retry returns it. `failed` leaves the money on your balance. If
you send neither, the transfer fails at the deadline.

```bash theme={null}
curl -X POST https://api.agentcard.sh/api/v2/company_wallet/transfers/owt_123/collection \
  -H "Authorization: Bearer $ORG_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"outcome": "succeeded"}'
```

The API returns the transfer again when you send the same outcome, so a retry is safe.


## OpenAPI

````yaml openapi.json POST /api/v2/company_wallet/transfers/{transfer_id}/collection
openapi: 3.1.0
info:
  title: Agentcard API
  version: 2.0.0
  description: >-
    The Agentcard v2 API — connect your users and verify their identity from
    your own backend. Every call is authenticated with a platform access token
    minted from your `client_id` + `client_secret`.
servers:
  - url: https://api.agentcard.sh
    description: >-
      There is one base URL. Sandbox vs production is decided by the client
      credential you use, never by the host.
security:
  - platformToken: []
tags:
  - name: Authentication
    description: >-
      Exchange your client credentials for a platform access token, and
      introspect what a token acts as.
  - name: Connect
    description: >-
      Connect a user to your platform: send a one-time code, verify it, record
      consent, and keep the connection alive.
  - name: Identity verification
    description: >-
      Verify a connected user's identity: upload their ID, submit any extra
      fields we ask for, then show a short face scan.
paths:
  /api/v2/company_wallet/transfers/{transfer_id}/collection:
    post:
      tags:
        - Company wallet
      summary: Confirm a collection
      description: >-
        Says whether you collected from your customer for a transfer waiting on
        you (`substatus: awaiting_collection`). `succeeded` lets it go on to the
        card; `failed` leaves the money on your balance. Send it before
        `collection_deadline`. The same outcome again answers the transfer
        again.
      operationId: companyWalletTransferCollection
      parameters:
        - name: transfer_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - outcome
              properties:
                outcome:
                  type: string
                  enum:
                    - succeeded
                    - failed
                  description: Whether you collected.
      responses:
        '200':
          description: The transfer, as the outcome left it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyWalletTransfer'
        '400':
          description: '`invalid_request`: an outcome other than `succeeded` or `failed`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            `transfer_not_found`: no such transfer on your company, in this
            credential's mode.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `collection_window_expired`: the deadline passed and the transfer
            failed. `transfer_not_awaiting_collection`: it isn't waiting on you,
            or it was confirmed with the other outcome.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - platformToken: []
components:
  schemas:
    CompanyWalletTransfer:
      type: object
      required:
        - object
        - id
        - status
        - substatus
        - kind
        - user_id
        - amount_cents
        - livemode
        - created_at
      properties:
        object:
          type: string
          description: Always `company_wallet_transfer`.
          enum:
            - company_wallet_transfer
        id:
          type: string
        status:
          type: string
          enum:
            - pending
            - funded
            - consumed
            - reclaimed
            - failed
          description: >-
            `pending` until the money reaches the card, `funded` once it has,
            `consumed` once the card holds it, `reclaimed` once a closed card
            gave it back, `failed` when it never moved.
        substatus:
          type: string
          description: >-
            Where a `pending` transfer is: `awaiting_collection` (waiting on
            you), `collection_confirmed` or `transferring`.
        kind:
          type: string
          description: '`mint` for a new card, `top_up` for a raise on an existing one.'
        user_id:
          type:
            - string
            - 'null'
          description: The user the card is for.
        card_id:
          type:
            - string
            - 'null'
          description: The card the transfer made or raised.
        amount_cents:
          type: integer
          description: What the card asked for.
        fee_cents:
          type: integer
          description: The fee on top.
        transferred_cents:
          type: integer
          description: What has moved so far.
        released_cents:
          type: integer
          description: >-
            What a closed card gave back. It counts toward the user's next card
            until you recover it.
        failure_reason:
          type:
            - string
            - 'null'
          description: Why a `failed` transfer failed.
        collection_deadline:
          type:
            - string
            - 'null'
          description: When a transfer waiting on you fails if you haven't confirmed it.
        livemode:
          type: boolean
          description: '`false` on a sandbox credential.'
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      description: Every v2 error uses the same envelope.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable string (snake_case). Branch on this.
            message:
              type: string
              description: A human-readable explanation, safe to log.
            docs:
              type: string
              description: A link back to the reference.
            field_errors:
              type: object
              additionalProperties:
                type: string
              description: Only on `invalid_fields` — names each field to fix.
            warnings:
              type: array
              items:
                type: string
              description: >-
                Only on document upload errors — actionable feedback safe to
                show the user.
            status:
              type: string
              description: >-
                Only on `verification_terminally_rejected` — the user's current
                verification status, which this call did not change.
            reason:
              type: string
              description: >-
                The detail behind the failure, on the errors that carry one: on
                `verification_terminally_rejected` an end-user-safe explanation
                of the rejection, when the review left one; on `invalid_code`
                and `invalid_return_url` which part of the input was refused.
            reason_code:
              type: string
              description: >-
                Only on `verification_terminally_rejected`, and only when the
                rejection maps to a known class — most final rejections carry no
                code.
  responses:
    Unauthorized:
      description: >-
        `unauthorized` — the platform access token is missing or expired.
        Exchange your client credentials for a fresh one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    platformToken:
      type: http
      scheme: bearer
      description: >-
        A platform access token. Get one on the **Create an access token**
        endpoint by exchanging your `client_id` + `client_secret`, then send it
        as `Authorization: Bearer <token>`. Tokens live one hour.

````

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