> For the complete documentation index, see [llms.txt](https://docs.coridor.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coridor.fun/developers/send-receive-usdc.md).

# Send / Receive USDC

On-chain Stellar steps for Coridor deposit and withdraw.

## Withdraw — wallet **sends** USDC

When SEP-24 status is **`pending_user_transfer_start`**, the wallet submits a payment:

| From transaction object   | Use                      |
| ------------------------- | ------------------------ |
| `withdraw_anchor_account` | Destination              |
| `withdraw_memo`           | **Memo (ID)** — required |
| `amount_in`               | USDC amount to send      |

```typescript
onMessage: (transaction) => {
  if (transaction.status === "pending_user_transfer_start") {
    const tx = txBuilder
      .transferWithdrawalTransaction(transaction, usdcAsset)
      .build();
    tx.sign(userKeypair);
    await stellar.submitTransaction(tx);
  }
};
```

Distribution account (inventory): `GCACTDNRY4V7QD4M6FSPGLCR5BNANSLBHIKACRTPSZ4B75NKL66QGSVS`

**User must approve** the transaction in the wallet (SEP-24 standard).

## Withdraw — what happens next

1. Horizon observer detects USDC payment + memo
2. coridor-server triggers **Xendit IDR payout** to the bank account from the widget
3. SEP-24 status → **`completed`**

IDR arrives via **bank transfer** to the account the user entered in the widget.

## Deposit — wallet **receives** USDC

The wallet does **not** send USDC for deposit.

1. User pays **IDR** in the Coridor widget (Xendit)
2. Webhook / simulate completes deposit
3. Anchor sends **USDC to the user’s Stellar account** (from distribution account)

Monitor the user account for incoming USDC or poll SEP-24 until **`completed`**.

## Memo & trustline

* User account must have **USDC trustline** to issuer `GATALTGT...`
* Deposit: no memo required from user for the inbound USDC leg
* Withdraw: **memo is mandatory** on the outbound USDC payment

## Error handling

Use Stellar SDK retry patterns for `tx_bad_seq` and 504 timeouts. See [Stellar error handling](https://developers.stellar.org/docs/learn/encyclopedia/errors-and-debugging/error-handling) and [Horizon result codes](https://developers.stellar.org/docs/data/apis/horizon/api-reference/errors).

## Next

[Poll transaction status](/developers/poll-transaction-status.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.coridor.fun/developers/send-receive-usdc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
