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

# Settlement Flow

> Complete example of a cross-platform payment using Opencharge settlement

## Complete Example: PayPal → MTN MOMO

```mermaid theme={null}
sequenceDiagram
    participant PayPal
    participant MTN as MTN MOMO
    participant Barclays
    participant Merchant

    Note over PayPal,Merchant: PayPal user wants to pay MTN MOMO merchant 10,000 UGX

    rect rgb(240, 248, 255)
    Note over PayPal,MTN: Step 1: Discover settlement preferences
    PayPal->>MTN: GET /capabilities
    MTN-->>PayPal: { settlement.accepts: [100, 101] }
    Note over PayPal: "I have reserves at Barclays (OCID 100). Perfect."
    end

    rect rgb(255, 248, 240)
    Note over PayPal,MTN: Step 2: Initiate payment request
    PayPal->>MTN: POST /payment/create<br/>{to: 500, amount: "10000.00", currency: "UGX"}
    Note over MTN: Maps OCID 500 → merchant phone number
    MTN-->>PayPal: { status: "pending_settlement", txid: "momo_tx_789" }
    end

    rect rgb(240, 255, 240)
    Note over PayPal,Barclays: Step 3: Instruct Barclays to pay MTN
    PayPal->>Barclays: POST /transfer<br/>{to: {ocid: 300, reference: "momo_tx_789"}}
    Note over Barclays: Debits PayPal, credits MTN's account
    Barclays-->>PayPal: { status: "completed", proof: {...}, signature: "abc123..." }
    end

    rect rgb(255, 240, 255)
    Note over PayPal,MTN: Step 4: Submit proof to MTN
    PayPal->>MTN: POST /payment/settle<br/>{txid: "momo_tx_789", proof: {...}}
    Note over MTN: ✓ Signature valid<br/>✓ Issuer trusted<br/>✓ Amount matches
    MTN->>Merchant: Credits merchant account
    MTN-->>PayPal: { status: "completed", proof: {...}, signature: "def456..." }
    end

    Note over PayPal,Merchant: Done! Merchant receives funds.
```

**What each party holds:**

| Party    | Proofs Held                                                      |
| -------- | ---------------------------------------------------------------- |
| PayPal   | Barclays proof (sent to MTN) + MTN proof (confirmation)          |
| MTN      | Barclays proof (internal audit) + own proof (issued to merchant) |
| Merchant | MTN proof (confirmation of receipt)                              |
| Barclays | Internal records + proof issued to PayPal                        |
