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

# Metode Pembayaran

> Ambil daftar channel dan metode pembayaran yang tersedia beserta batas nominalnya.

`GET /api/v1/payments/list`

Ambil daftar semua channel dan metode pembayaran yang tersedia di platform beserta batas nominalnya. Endpoint ini tidak memerlukan autentikasi.

Mengembalikan seluruh channel pembayaran yang didukung platform (`qris`, `va`, `ewallet`) beserta kode tujuan (`dstCode`), nama, dan batas nominal masing-masing. Gunakan response ini untuk membangun UI pemilihan metode pembayaran atau memvalidasi kombinasi `channel` + `dstCode` sebelum memanggil `POST /api/v1/payments/create`.

Tidak ada parameter query maupun request body.

### Contoh request

```bash cURL theme={null}
curl -X GET "http://localhost:5173/api/v1/payments/list"
```

```javascript JavaScript theme={null}
const res = await fetch("http://localhost:5173/api/v1/payments/list");
const { data } = await res.json();

// Tampilkan semua metode per channel
data.channels.forEach((ch) => {
  console.log(ch.channel, ch.dstCodes.map((d) => d.code));
});
```

```php PHP theme={null}
<?php
$response = file_get_contents("http://localhost:5173/api/v1/payments/list");
$data = json_decode($response, true)["data"];

foreach ($data["channels"] as $ch) {
    echo $ch["channel"] . ": " . implode(", ", array_column($ch["dstCodes"], "code")) . PHP_EOL;
}
```

```javascript Node.js theme={null}
import axios from "axios";

const { data: res } = await axios.get("http://localhost:5173/api/v1/payments/list");

res.data.channels.forEach((ch) => {
  console.log(ch.channel, ch.dstCodes.map((d) => d.code));
});
```

```python Python theme={null}
import requests

res = requests.get("http://localhost:5173/api/v1/payments/list")
data = res.json()["data"]

for ch in data["channels"]:
    print(ch["channel"], [d["code"] for d in ch["dstCodes"]])
```

```go Golang theme={null}
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	resp, err := http.Get("http://localhost:5173/api/v1/payments/list")
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	var result struct {
		Data struct {
			Channels []struct {
				Channel  string `json:"channel"`
				DstCodes []struct {
					Code string `json:"code"`
				} `json:"dstCodes"`
			} `json:"channels"`
		} `json:"data"`
	}
	json.NewDecoder(resp.Body).Decode(&result)

	for _, ch := range result.Data.Channels {
		fmt.Println(ch.Channel, ch.DstCodes)
	}
}
```

```rust Rust theme={null}
// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, serde_json = "1", tokio = { version = "1", features = ["full"] }
use serde_json::Value;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let res: Value = reqwest::get("http://localhost:5173/api/v1/payments/list")
        .await?
        .json()
        .await?;

    if let Some(channels) = res["data"]["channels"].as_array() {
        for ch in channels {
            println!("{} {}", ch["channel"], ch["dstCodes"]);
        }
    }
    Ok(())
}
```

### Contoh response

```json 200 theme={null}
{
  "success": true,
  "data": {
    "channels": [
      {
        "channel": "qris",
        "name": "QRIS Dinamis",
        "description": "Scan QR Code menggunakan aplikasi m-Banking atau dompet digital.",
        "dstCodes": [
          { "code": "QRIS", "name": "QRIS (Universal)", "minAmount": 10000, "maxAmount": 10000000 }
        ]
      },
      {
        "channel": "va",
        "name": "Virtual Account Bank",
        "description": "Transfer melalui m-Banking, ATM, atau transfer antar bank.",
        "dstCodes": [
          { "code": "BCA",      "name": "BCA Virtual Account",            "minAmount": 10000, "maxAmount": 2000000  },
          { "code": "BNI",      "name": "BNI Virtual Account",            "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "BRI",      "name": "BRI Virtual Account (BRIVA)",    "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "MANDIRI",  "name": "Mandiri Virtual Account",        "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "PERMATA",  "name": "Permata Virtual Account",        "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "CIMB",     "name": "CIMB Niaga Virtual Account",     "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "BSI",      "name": "Bank Syariah Indonesia",         "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "DANAMON",  "name": "Bank Danamon",                   "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "MUAMALAT", "name": "Bank Muamalat",                  "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "NEO",      "name": "Bank Neo Commerce",              "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "OCBC",     "name": "Bank OCBC NISP",                 "minAmount": 10000, "maxAmount": 50000000 },
          { "code": "SINARMAS", "name": "Bank Sinarmas",                  "minAmount": 10000, "maxAmount": 50000000 }
        ]
      },
      {
        "channel": "ewallet",
        "name": "Dompet Digital (E-Wallet)",
        "description": "Bayar langsung melalui aplikasi dompet digital.",
        "dstCodes": [
          { "code": "DANA",      "name": "DANA",      "minAmount": 10000, "maxAmount": 20000000 },
          { "code": "OVO",       "name": "OVO",       "minAmount": 10000, "maxAmount": 20000000 },
          { "code": "GOPAY",     "name": "GoPay",     "minAmount": 10000, "maxAmount": 20000000 },
          { "code": "SHOPEEPAY", "name": "ShopeePay", "minAmount": 10000, "maxAmount": 20000000 },
          { "code": "LINKAJA",   "name": "LinkAja",   "minAmount": 10000, "maxAmount": 20000000 }
        ]
      }
    ]
  }
}
```

```json Error theme={null}
{
  "error": "Gagal mengambil daftar metode pembayaran"
}
```

### Field response

| Field | Tipe | Deskripsi |
| - | - | - |
| `data.channels` | array | Daftar channel pembayaran yang tersedia |
| `channels[].channel` | string | Kode channel: `qris` \| `va` \| `ewallet` |
| `channels[].name` | string | Nama tampilan channel |
| `channels[].description` | string | Deskripsi singkat metode |
| `channels[].dstCodes` | array | Daftar kode tujuan yang tersedia untuk channel ini |
| `dstCodes[].code` | string | Kode `dstCode` yang digunakan di `POST /create` (contoh: `QRIS`, `BCA`, `DANA`) |
| `dstCodes[].name` | string | Nama tampilan metode |
| `dstCodes[].minAmount` | number | Nominal minimum dalam Rupiah |
| `dstCodes[].maxAmount` | number | Nominal maksimum dalam Rupiah |

> [!TIP]
>
> * Cache response ini di sisi client karena data jarang berubah. Tidak perlu dipanggil setiap kali user membuka halaman checkout.
> * Gunakan `dstCodes[].minAmount` dan `maxAmount` untuk validasi nominal di frontend sebelum memanggil create payment.
> * Kombinasi `channel` + `code` dari respons ini langsung dipakai sebagai `channel` + `dstCode` di `POST /api/v1/payments/create`.


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