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

# How payments work

> From a payment link to funds in your wallet.

A payment has two parts: the **payment link** you create once, and an **order** for each attempt to pay it. The link holds the price; an order locks that price into a coin amount and gets its own deposit address.

```mermaid theme={null}
sequenceDiagram
    participant S as Your server
    participant P as Paywire
    participant C as Payer
    participant B as Blockchain
    S->>P: POST /payments/links (amount, coins, callback URL)
    P-->>S: link id
    S->>C: Send the payer to pay.paywire.xyz/pay/{id}
    C->>P: Pick a coin and network
    P-->>C: Order: deposit address, exact amount, expiry
    C->>B: Send the amount
    B-->>P: Transfer seen, then confirmed
    P->>S: Webhook: order.settled (signed)
    P->>B: Sweep funds into your wallet
```

## Step by step

1. **You create a link** for an amount in USD, the coins you accept and the URL that receives webhooks. A link can be paid more than once: each visit can start its own order.
2. **The payer picks a coin.** Paywire fetches a live price, locks it into an **order** with the exact amount in the coin's smallest unit, and issues a deposit address that belongs to that order alone. The quote holds for the link's payment window (30 minutes by default).
3. **The payer sends the amount.** Paywire sees the transfer within seconds and the order moves to `Confirming`.
4. **The chain confirms it.** Once the transfer has enough confirmations (see [Networks and assets](https://docs.paywire.xyz/concepts/networks-and-assets.md)) the order resolves: usually `Settled`. Your callback URL receives a signed webhook.
5. **Paywire sweeps the funds** from the deposit address into your wallet. For tokens it first sends the address a little gas. You don't need to do anything.

## When the payer gets it wrong

Payers send too little, too much, too late, or the wrong coin. Paywire applies a **payment policy** with three numbers:

| Setting | What it does |
| - | - |
| **Tolerance** (%) | An amount this close to the quote counts as paid in full. |
| **Dust threshold** | Overpaying by no more than this is kept, not refunded. |
| **Review threshold** | Differences above this wait for a person to decide. |

What happens then:

* **Underpaid:** the order keeps waiting until the quote expires; it then ends `ExpiredUnderpaid` and the partial amount is refunded (or kept if it's dust).
* **Overpaid:** the order is paid; the excess is refunded if it's above the dust threshold, or the order goes to `ManualReview` if it's above the review threshold.
* **Late:** money arriving after the order resolved is refunded or reviewed the same way.
* **Wrong coin:** a token the order didn't quote is never credited or moved; it waits for review.

Refunds go to the payer's **refund address** if they gave one when the order was created. The company-wide policy is set in the dashboard, and a single link can override it with `policyOverride`.

## Where the money goes

Each Paywire account has one or more **MPC wallets**. Every deposit address is derived from one of them, so swept funds land in a wallet you own. Which wallet receives which coin is set per gateway in the dashboard (*wallet routing*); by default everything goes to your default wallet.


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