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

> ## Agent Instructions
> Before reading these docs, install the relevant Circle Skill to get pre-loaded context — skills are LLM-optimized and cover architecture decisions, correct flows, and common pitfalls. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills. Available skills: use-usdc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md (balances, transfers, approvals on EVM and Solana); EURC has no skill — see https://developers.circle.com/stablecoins/what-is-eurc.md; bridge-stablecoin https://github.com/circlefin/skills/blob/master/plugins/circle/skills/bridge-stablecoin/SKILL.md (crosschain transfers via CCTP, USDC, EURC, and third-party assets); use-arc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md (Arc chain config, contract deployment, USDC bridging — Arc docs: https://docs.arc.io/llms.txt); use-circle-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md (choose wallet type); use-developer-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md (custodial wallets for payouts and treasury); use-user-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md (embedded wallets with Web2 login); use-modular-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md (smart contract wallets with passkeys and ERC-4337); use-gateway https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md (unified USDC balance, nanopayments); use-smart-contract-platform https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md (deploy, interact, monitor contracts). Pair any skill with the Circle MCP server for live SDK signatures, contract addresses, and chain IDs: {"mcpServers":{"circle":{"url":"https://api.circle.com/v1/codegen/mcp"}}}.
> Read the product overview first. Each product has an overview explaining when and why to use it. Read it before quickstarts.
> Pick the right wallet type. Developer-controlled (you hold keys), user-controlled (end user holds keys via PIN/social login), or modular (smart contract wallets with passkeys). See https://developers.circle.com/wallets.md.
> Use CCTP V2 for crosschain transfers. CCTP natively transfers USDC and EURC via burn-and-mint, and supports permissionless wrapping of third-party assets via lock-and-mint. V1 is legacy; always use V2 unless V1 is specified or the chain requires it (Noble, Sui, and Aptos still require V1). Migration guide: https://developers.circle.com/cctp/migration-from-v1-to-v2.md.
> Use Bridge Kit for frontend bridging. Wraps CCTP with a simpler SDK for user-facing apps. Use CCTP directly for backend transfers.
> Gas Station vs Paymaster. Gas Station sponsors gas for Circle Wallet transactions. Paymaster lets users pay gas in USDC. Different use cases — read both overviews.
> Gateway Nanopayments for sub-cent payments. Gasless USDC micropayments down to $0.000001 via x402 and batched settlement. For pay-per-request APIs, AI agent payments, streaming.
> Look up USDC addresses per chain. Never hardcode — use https://developers.circle.com/stablecoins/usdc-contract-addresses.md.
> Prefer SDKs over raw API calls. Node.js and Python SDKs handle auth, retries, and errors.
> API key required. Bearer token in Authorization header. Testnet and mainnet use separate keys and may use different base URLs depending on the product.
> Set up webhooks when available. Most operations are async. Webhooks deliver transaction confirmations and state changes.
> When calling list endpoints, paginate using pageSize and pageAfter until no nextPageAfter cursor is returned—stopping at the first page silently misses records.
> Building an AI agent? Start with the Agent Stack—Circle CLI, agent wallets, and nanopayments built for autonomous use cases: https://developers.circle.com/agent-stack.md.

# How-to: Refund a stablecoin payin

> Issue a refund for a stablecoin payin. Covers the Circle LLC (US) and Circle Singapore (CIRCLE_SG) flows.

Use the Managed Payments API to return funds from a settled stablecoin payin to
the original sender or another recipient address. For context on how payins are
received, see
[Receive stablecoin payins](/cpn/managed-payments/quickstarts/receive-stablecoin-payins).

<Warning>
  Crypto refunds are irreversible. Circle does not default to a return mode.
  Always confirm with your customer which wallet and exchange they want funds
  returned to. Many exchanges send from omnibus wallets shared across users.
  Refunding to the original sender address can route funds to an omnibus wallet,
  making the refund difficult to attribute and potentially resulting in lost
  customer funds.
</Warning>

## Prerequisites

Before you begin, ensure that you've:

* Enabled Managed Payments with your Circle legal entity.
* Received a completed crypto payment with `status: "paid"` and noted the
  payment intent ID.
* Created an API key with Managed Payments access from the
  [CPN Console](https://cpn.circle.com).
* (Circle Singapore Mode 2 only) Obtained the Address Book entitlement from
  Circle and noted the `paymentId` of the original payment from `paymentIds[]`
  on the intent.

## Steps

The refund flow differs by Circle entity. Circle LLC (US) merchants refund to a
raw blockchain address. Circle Singapore (`CIRCLE_SG`) merchants must refund
through a registered address book entry or back to the original sender—raw
addresses are not permitted. Select the tab for the Circle entity that books
your payins.

<Tabs>
  <Tab title="Circle LLC (US)">
    ### Initiate the refund

    Send a `POST` request to `/v1/paymentIntents/{paymentIntentId}/refund`. Set
    `destination.address` to the recipient's blockchain address and
    `destination.chain` to the correct network.

    ```bash theme={null}
    curl -X POST 'https://api-sandbox.circle.com/v1/paymentIntents/{paymentIntentId}/refund' \
      --header 'Authorization: Bearer $API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
        "idempotencyKey": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
        "destination": {
          "address": "0x57414adbBbc4BBA36f1dE26b2dc1648b28ae7799",
          "chain": "ETH"
        },
        "amount": {
          "currency": "USD"
        },
        "toAmount": {
          "amount": "5.00",
          "currency": "USD"
        }
      }'
    ```

    A successful response returns a `Refund` object with `status: "pending"`:

    ```json theme={null}
    {
      "data": {
        "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
        "paymentIntentId": "c3d4e5f6-7890-4ab2-cdef-3456789012cd",
        "amount": {
          "amount": "5.00",
          "currency": "USD"
        },
        "status": "pending"
      }
    }
    ```

    Circle settles the refund onchain and updates the status to `paid` when
    complete. For the full lifecycle, see
    [Stablecoin payin states](/cpn/managed-payments/references/payment-intent-states).
  </Tab>

  <Tab title="Circle Singapore (CIRCLE_SG)">
    Circle Singapore (`CIRCLE_SG`) merchants must issue Travel Rule-compliant
    refunds. Raw onchain addresses are not permitted. Every refund request requires
    a `paymentId` from `paymentIds[]` on the intent. Circle uses it to carry forward
    Travel Rule data from the original payment. Two modes are available: return to
    the original sender, or refund to a new address book entry.

    ### Mode 1: Return to the original sender

    No address book entry is needed.

    #### Initiate the refund

    Send a `POST` request to `/v1/paymentIntents/{paymentIntentId}/refund`. Set
    `destination.useOriginalSender` to `true` and include the `paymentId` of the
    original payment.

    ```bash theme={null}
    curl -X POST 'https://api-sandbox.circle.com/v1/paymentIntents/{paymentIntentId}/refund' \
      --header 'Authorization: Bearer $API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
        "idempotencyKey": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
        "destination": {
          "useOriginalSender": true
        },
        "amount": {
          "currency": "USD"
        },
        "toAmount": {
          "amount": "5.00",
          "currency": "USD"
        },
        "paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
      }'
    ```

    A successful response returns a `Refund` object with `status: "pending"`:

    ```json theme={null}
    {
      "data": {
        "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
        "paymentIntentId": "c3d4e5f6-7890-4ab2-cdef-3456789012cd",
        "paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
        "amount": {
          "amount": "5.00",
          "currency": "USD"
        },
        "status": "pending"
      }
    }
    ```

    Circle settles the refund onchain and updates the status to `paid` when
    complete. For the full lifecycle, see
    [Stablecoin payin states](/cpn/managed-payments/references/payment-intent-states).

    ### Mode 2: Return to a different address

    This mode sends the refund to a new recipient. It reuses the PII from the
    original payment. Register the recipient address in the address book first,
    using the original `paymentId` to link the PII. The recipient's Virtual Asset
    Service Provider (VASP) must match the sender's VASP. Verify this before you
    register the address.

    #### Step 1. Register the refund address

    Send a `POST` request to `/v1/payments/refundAddresses`. Set `paymentId` to link
    the PII from the original payment to this new address.

    ```bash theme={null}
    curl -X POST 'https://api-sandbox.circle.com/v1/payments/refundAddresses' \
      --header 'Authorization: Bearer $API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
        "idempotencyKey": "bfcd6dc1-05a1-420a-a68f-8f9bf47a9394",
        "chain": "ETH",
        "address": "0x57414adbBbc4BBA36f1dE26b2dc1648b28ae7799",
        "metadata": {
          "nickname": "Refund Address 1"
        },
        "ownership": {
          "custody": {
            "type": "hosted",
            "vaspId": "581b9b20-28e1-464d-a257-e408733d0857"
          },
          "type": "third_party"
        },
        "paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
      }'
    ```

    The response returns an entry with a generated `id` (the `addressBookId`) and
    `status: "pending"`.

    ```json theme={null}
    {
      "data": {
        "id": "7418ddb1-1bbf-5506-88f9-209a25c63b8b",
        "status": "pending",
        "chain": "ETH",
        "address": "0x57414adbBbc4BBA36f1dE26b2dc1648b28ae7799"
      }
    }
    ```

    <Note>
      In sandbox, use `paymentId: "c0000000-0000-0000-0000-000000000000"` to trigger
      instant address approval.
    </Note>

    #### Step 2. Poll until the address is active

    Send a
    [`GET /v1/addressBook/recipients/{id}`](/api-reference/cpn/managed-payments/address-book/get-address-book-recipient)
    request and poll until `status` returns `"active"`.

    ```bash theme={null}
    curl -X GET 'https://api-sandbox.circle.com/v1/addressBook/recipients/{id}' \
      --header 'Authorization: Bearer $API_KEY'
    ```

    When the address is approved, the response returns `status: "active"`:

    ```json theme={null}
    {
      "data": {
        "id": "7418ddb1-1bbf-5506-88f9-209a25c63b8b",
        "status": "active",
        "chain": "ETH",
        "address": "0x57414adbBbc4BBA36f1dE26b2dc1648b28ae7799"
      }
    }
    ```

    #### Step 3. Initiate the refund

    Send a `POST` request to `/v1/paymentIntents/{paymentIntentId}/refund`. Set
    `destination.addressBookId` to the `id` from Step 1 and include the same
    `paymentId`.

    ```bash theme={null}
    curl -X POST 'https://api-sandbox.circle.com/v1/paymentIntents/{paymentIntentId}/refund' \
      --header 'Authorization: Bearer $API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
        "idempotencyKey": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "destination": {
          "addressBookId": "7418ddb1-1bbf-5506-88f9-209a25c63b8b"
        },
        "amount": {
          "currency": "USD"
        },
        "toAmount": {
          "amount": "5.00",
          "currency": "USD"
        },
        "paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
      }'
    ```

    A successful response returns a `Refund` object with `status: "pending"`:

    ```json theme={null}
    {
      "data": {
        "id": "b2c3d4e5-6789-01ab-cdef-2345678901bc",
        "paymentIntentId": "c3d4e5f6-7890-4ab2-cdef-3456789012cd",
        "paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
        "amount": {
          "amount": "5.00",
          "currency": "USD"
        },
        "status": "pending"
      }
    }
    ```

    Circle settles the refund onchain and updates the status to `paid` when
    complete. For the full lifecycle, see
    [Stablecoin payin states](/cpn/managed-payments/references/payment-intent-states).
  </Tab>
</Tabs>

## Error handling

If the request fails, the response contains a numeric error code and message.
Common failures include an invalid `paymentId`, an inactive address book entry,
or a VASP mismatch between the sender and recipient. For the full list of codes
and remediation steps, see
[Error codes](/cpn/managed-payments/references/error-codes).
