> 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/overview/how-coridor-works.md).

# How Coridor works

Coridor follows the standard **Stellar anchor** pattern: authenticate, start a SEP-24 transaction, complete fiat steps in an interactive widget, then settle USDC on-chain.

## High-level flow

```mermaid
flowchart LR
  subgraph User
    W[Stellar wallet]
  end

  subgraph Coridor
    SEP[sep.coridor.fun\nSEP-10 / SEP-24]
    UI[api.coridor.fun\nInteractive widget]
    SRV[coridor-server\nRates · Xendit · Observer]
  end

  subgraph External
    X[Xendit\nVA · QRIS · OVO · Payout]
    H[Horizon\nOn-chain USDC]
  end

  W -->|SEP-10 auth| SEP
  W -->|SEP-24 deposit/withdraw| SEP
  SEP -->|interactive URL| UI
  UI -->|IDR pay or bank details| X
  X -->|webhook| SRV
  SRV -->|update transaction| SEP
  W -->|USDC payment withdraw| H
  H -->|detect payment| SRV
  SRV -->|send USDC deposit| H
  SRV -->|IDR payout withdraw| X
```

## Deposit (on-ramp): IDR → USDC

{% stepper %}
{% step %}

### Authenticate with SEP-10

User authenticates with **SEP-10** against `sep.coridor.fun`.
{% endstep %}

{% step %}

### Start a SEP-24 deposit

Wallet starts **SEP-24 deposit** and receives an interactive URL plus a transaction id.
{% endstep %}

{% step %}

### Enter payment details in the widget

User opens the widget, enters an IDR amount, and picks **VA**, **QRIS**, or **OVO**.
{% endstep %}

{% step %}

### Pay or simulate

User pays, or chooses **Simulate** in sandbox.
{% endstep %}

{% step %}

### Payment is confirmed

Xendit webhook confirms payment, and coridor-server notifies Anchor Platform.
{% endstep %}

{% step %}

### USDC is delivered

Anchor sends **USDC to the user's Stellar account**.

The wallet does **not** send USDC for deposit — Coridor delivers it after IDR is confirmed.
{% endstep %}
{% endstepper %}

## Withdraw (off-ramp): USDC → IDR

{% stepper %}
{% step %}

### Authenticate and start a withdraw

**SEP-10** is followed by **SEP-24 withdraw**, which opens the interactive widget.
{% endstep %}

{% step %}

### Enter bank details

User enters **bank account** details: bank name, account number, and holder name.
{% endstep %}

{% step %}

### Transaction waits for user transfer

Status becomes **`pending_user_transfer_start`**.
{% endstep %}

{% step %}

### Send USDC on-chain

Wallet sends **USDC** to Coridor's distribution account with the required **memo**.
{% endstep %}

{% step %}

### Payment is detected and payout is triggered

On-chain observer detects payment, and coridor-server triggers **Xendit bank payout**.
{% endstep %}

{% step %}

### IDR arrives and transaction completes

IDR arrives in the user's bank account, and the SEP-24 status becomes **`completed`**.
{% endstep %}
{% endstepper %}

## Rates and fees

* Market **USDC/IDR** from CoinGecko
* Default: **Rp 5,000** flat + **\~0.5%** spread
* Exposed via **SEP-38** and public `GET /rate` on `api.coridor.fun`

Use **Rp 50,000+** for deposits so the flat fee does not dominate small amounts.

## What happens in the widget

| Flow     | User does in widget                          |
| -------- | -------------------------------------------- |
| Deposit  | Amount IDR + payment method + pay / simulate |
| Withdraw | Bank details + confirm                       |

KYC (SEP-12) is simplified on staging (auto-accept). Production follows anchor policy.

## For developers

Integration is step-by-step in the [Developers](/developers/wallet-integration.md) section:

1. [Authenticate (SEP-10)](/developers/authenticate-sep-10.md)
2. [Initiate transaction (SEP-24)](/developers/initiate-transaction-sep-24.md)
3. [Poll status](/developers/poll-transaction-status.md)
4. [Send/receive USDC on-chain](/developers/send-receive-usdc.md) (withdraw)

## Related

* [What is Coridor?](/overview/what-is-coridor.md)
* [Architecture](/overview/architecture.md)
* [Deposit guide](/user/deposit.md) · [Withdraw guide](/user/withdraw.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/overview/how-coridor-works.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.
