{
  "openapi": "3.1.0",
  "info": {
    "title": "WASDLabs Payment Gateway API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://pay.wasdlabs.com/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "wsd_{env}_sk_*"
      }
    },
    "schemas": {
      "ChargeRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "merchant_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "method": {
            "type": "string",
            "enum": ["qris", "va", "ewallet", "retail", "cc"]
          },
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16
          },
          "amount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "customer": {
            "default": {},
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "phone": {
                "type": "string",
                "minLength": 6,
                "maxLength": 20
              },
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              }
            },
            "additionalProperties": false
          },
          "expires_in": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "return_url": {
            "type": "string",
            "format": "uri"
          },
          "metadata": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["merchant_ref", "method", "channel", "amount", "customer", "metadata"],
        "additionalProperties": false
      }
    }
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/charge": {
      "post": {
        "summary": "Membuat transaksi pembayaran baru untuk satu kanal (QRIS, VA, e-wallet, retail, atau kartu kredit). `settles_at` masih null di sini dan baru terisi saat transaksi lunas (H+1 pukul 09:00 WITA dihitung dari `paid_at`), karena jadwal pencairan mengikuti waktu pembayaran, bukan waktu pembuatan. Rate limit: 60 permintaan/menit per API key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChargeRequest"
              },
              "example": {
                "merchant_ref": "INV-88421",
                "method": "qris",
                "channel": "QRIS",
                "amount": 1850000,
                "customer": {
                  "name": "Andi Saputra",
                  "phone": "081244557781",
                  "email": "andi.s@gmail.com"
                },
                "expires_in": 900,
                "metadata": {
                  "cart_id": "9931"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "trx_id": "WSD-2K9F3A1",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "pending",
                  "method": "qris",
                  "channel": "QRIS",
                  "amount": {
                    "gross": 1850000,
                    "fee": 13950,
                    "net": 1836050
                  },
                  "payment": {
                    "qr_url": "https://pg.wasdlabs.id/get_image_qr?payid=abc123",
                    "qr_content": null
                  },
                  "upstream_ref": null,
                  "expires_at": "2026-09-20T14:36:44+08:00",
                  "paid_at": null,
                  "settles_at": null,
                  "created_at": "2026-09-20T14:21:44+08:00",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "Outlet belum aktif. Selesaikan verifikasi terlebih dahulu.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "outlet_suspended",
                    "message": "Outlet belum aktif. Selesaikan verifikasi terlebih dahulu."
                  }
                }
              }
            }
          },
          "409": {
            "description": "Idempotency-Key ini sudah dipakai untuk permintaan lain.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "idempotency_conflict",
                    "message": "Idempotency-Key ini sudah dipakai untuk permintaan lain."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Masa berlaku harus lebih dari 1 menit dan maksimal 3 bulan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "expiry_invalid",
                    "message": "Masa berlaku harus lebih dari 1 menit dan maksimal 3 bulan.",
                    "field": "expires_in"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          },
          "502": {
            "description": "Ditolak oleh penyedia pembayaran; alasan asli ada di field upstream.response_code.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "upstream_rejected",
                    "message": "Ditolak oleh penyedia pembayaran; alasan asli ada di field upstream.response_code."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/transactions": {
      "get": {
        "summary": "Daftar transaksi milik outlet dari API key, dengan filter opsional (status, method, merchant_ref, from, to — ISO 8601) dan paginasi cursor keyset (kirim next_cursor respons sebelumnya sebagai query cursor). Rate limit: 600/menit per API key.",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "trx_id": "WSD-2K9F3A1",
                      "merchant_ref": "INV-88421",
                      "outlet_id": "OTL-004",
                      "status": "paid",
                      "method": "qris",
                      "channel": "QRIS",
                      "amount": {
                        "gross": 1850000,
                        "fee": 13950,
                        "net": 1836050
                      },
                      "payment": {
                        "qr_url": "https://pg.wasdlabs.id/get_image_qr?payid=abc123",
                        "qr_content": null
                      },
                      "upstream_ref": "WP-QR-9931882",
                      "expires_at": "2026-09-20T14:36:44+08:00",
                      "paid_at": "2026-09-20T14:22:07+08:00",
                      "settles_at": "2026-09-21T09:00:00+08:00",
                      "created_at": "2026-09-20T14:21:44+08:00",
                      "metadata": {
                        "cart_id": "9931"
                      }
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Permintaan tidak valid (kode ini dipakai sebagai kode generik untuk semua kegagalan validasi query, bukan hanya nominal).",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "amount_invalid",
                    "message": "Permintaan tidak valid (kode ini dipakai sebagai kode generik untuk semua kegagalan validasi query, bukan hanya nominal).",
                    "field": "status"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/transactions/{code}": {
      "get": {
        "summary": "Detail satu transaksi berdasarkan trx_id (kode internal WASDLabs, bukan merchant_ref).",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "trx_id": "WSD-2K9F3A1",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "paid",
                  "method": "qris",
                  "channel": "QRIS",
                  "amount": {
                    "gross": 1850000,
                    "fee": 13950,
                    "net": 1836050
                  },
                  "payment": {
                    "qr_url": "https://pg.wasdlabs.id/get_image_qr?payid=abc123",
                    "qr_content": null
                  },
                  "upstream_ref": "WP-QR-9931882",
                  "expires_at": "2026-09-20T14:36:44+08:00",
                  "paid_at": "2026-09-20T14:22:07+08:00",
                  "settles_at": "2026-09-21T09:00:00+08:00",
                  "created_at": "2026-09-20T14:21:44+08:00",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaksi tidak ditemukan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Transaksi tidak ditemukan."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/transactions/{code}/cancel": {
      "post": {
        "summary": "Membatalkan transaksi yang belum dibayar (status pending). Nomor bayar juga dibatalkan di penyedia pembayaran, jadi pelanggan tidak bisa membayarnya lagi. Rate limit: 60/menit per API key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "reason": "Stok habis, pesanan dibatalkan pelanggan."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "trx_id": "WSD-2K9F3A1",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "canceled",
                  "method": "qris",
                  "channel": "QRIS",
                  "amount": {
                    "gross": 1850000,
                    "fee": 13950,
                    "net": 1836050
                  },
                  "payment": {
                    "qr_url": "https://pg.wasdlabs.id/get_image_qr?payid=abc123",
                    "qr_content": null
                  },
                  "upstream_ref": null,
                  "expires_at": "2026-09-20T14:36:44+08:00",
                  "paid_at": null,
                  "settles_at": null,
                  "created_at": "2026-09-20T14:21:44+08:00",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "Transaksi berstatus paid tidak dapat dibatalkan (hanya status pending yang bisa).",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "Transaksi berstatus paid tidak dapat dibatalkan (hanya status pending yang bisa)."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaksi tidak ditemukan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Transaksi tidak ditemukan."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          },
          "502": {
            "description": "Gateway pembayaran tidak dapat dihubungi.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "upstream_unavailable",
                    "message": "Gateway pembayaran tidak dapat dihubungi."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/transactions/{code}/sync": {
      "post": {
        "summary": "Memaksa polling status transaksi langsung ke penyedia pembayaran — dipakai saat webhook callback terlambat atau gagal. Rate limit: 1×/menit PER TRANSAKSI (trx_id), bukan per API key.",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "trx_id": "WSD-2K9F3A1",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "pending",
                  "method": "qris",
                  "channel": "QRIS",
                  "amount": {
                    "gross": 1850000,
                    "fee": 13950,
                    "net": 1836050
                  },
                  "payment": {
                    "qr_url": "https://pg.wasdlabs.id/get_image_qr?payid=abc123",
                    "qr_content": null
                  },
                  "upstream_ref": null,
                  "expires_at": "2026-09-20T14:36:44+08:00",
                  "paid_at": null,
                  "settles_at": null,
                  "created_at": "2026-09-20T14:21:44+08:00",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaksi tidak ditemukan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Transaksi tidak ditemukan."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Sudah disinkronkan dalam 1 menit terakhir untuk transaksi ini. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Sudah disinkronkan dalam 1 menit terakhir untuk transaksi ini. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "summary": "Saldo outlet: tersedia, pending settlement, dan reserve sengketa. Wajib API key yang terikat pada satu outlet (bukan API key gabungan multi-outlet). Rate limit: 600/menit per API key.",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "available": 468209830,
                  "pending_settlement": 84207100,
                  "reserve": 6120000
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key ini tidak terikat pada satu outlet.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "API key ini tidak terikat pada satu outlet."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/refunds": {
      "post": {
        "summary": "Ajukan refund atas transaksi milik outlet ini. Membuat KASUS, bukan mengeksekusi — tidak ada proses refund otomatis, jadi eksekusi (transfer dari kas WASDLabs) tetap manual lewat panel. Tanpa `amount` = refund penuh (nominal bersih transaksi). Idempoten lewat header `Idempotency-Key`, sama seperti `/charge`. Rate limit: 60/menit per API key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "trx_id": "WSD-2K9F3A1",
                "amount": 500000,
                "reason": "Pelanggan membatalkan sebagian pesanan.",
                "merchant_ref": "RFD-INV-88421-01"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "refund_id": "RFD-2609-0001",
                  "trx_id": "WSD-2K9F3A1",
                  "merchant_ref": "RFD-INV-88421-01",
                  "kind": "refund_partial",
                  "status": "action_required",
                  "amount": 500000,
                  "reason": "Pelanggan membatalkan sebagian pesanan.",
                  "created_at": "2026-09-20T14:40:12+08:00"
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "Transaksi berstatus pending tidak dapat direfund (hanya status paid yang bisa).",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "Transaksi berstatus pending tidak dapat direfund (hanya status paid yang bisa)."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaksi tidak ditemukan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Transaksi tidak ditemukan.",
                    "field": "trx_id"
                  }
                }
              }
            }
          },
          "409": {
            "description": "Idempotency-Key ini sudah dipakai untuk permintaan lain.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "idempotency_conflict",
                    "message": "Idempotency-Key ini sudah dipakai untuk permintaan lain."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Nominal refund tidak boleh melebihi nominal transaksi (1836050).",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "amount_invalid",
                    "message": "Nominal refund tidak boleh melebihi nominal transaksi (1836050).",
                    "field": "amount"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/payouts": {
      "get": {
        "summary": "Riwayat penarikan dana yang diajukan outlet dari API key, dengan filter opsional (`status` bernilai `pending`, `paid`, atau `rejected` dipisah koma, plus `from`/`to` ISO 8601) dan paginasi cursor keyset. Wajib API key yang terikat pada satu outlet. Penarikan diajukan dari panel (Saldo & Wallet → Tarik dana); belum ada endpoint publik untuk mengajukannya. `amount` adalah rupiah utuh tanpa biaya penarikan, `note` berisi alasan penolakan bila `rejected`, dan `executed_at` adalah waktu konfirmasi atau penolakan. Rate limit: 600/menit per API key.",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "payout_id": "PO-260924-01",
                      "outlet_id": "OTL-004",
                      "bank_code": "BCA",
                      "bank_last4": "4821",
                      "amount": 5000000,
                      "status": "paid",
                      "note": null,
                      "created_at": "2026-09-24T10:12:04+08:00",
                      "executed_at": "2026-09-24T14:35:51+08:00"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key ini tidak terikat pada satu outlet.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "API key ini tidak terikat pada satu outlet."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/checkouts": {
      "post": {
        "summary": "Membuat tagihan Checkout Page: pelanggan diarahkan ke `checkout_url` dan membayar di halaman kami (pilih metode lalu bank/penyedia, tanpa mengisi nama). Tanpa `methods` = semua metode yang punya kanal aktif. E-Wallet dan Kartu Kredit tetap ditawarkan tanpa `customer.phone`: halaman meminta No. HP ke pembayar saat metode itu dipilih. `merchant_ref` unik per outlet per environment, maksimal 44 karakter: body identik (nominal + deskripsi) mengembalikan checkout yang sama (`200`), body berbeda `409`. Default berlaku 24 jam. Rate limit: 60 permintaan/menit per API key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "merchant_ref": "INV-88421",
                "description": "Pesanan #88421 Kopi Panakkukang",
                "amount": 185000,
                "methods": ["qris", "va"],
                "customer": {
                  "name": "Andi Saputra",
                  "phone": "081244557781",
                  "email": "andi.s@gmail.com"
                },
                "return_url": "https://tokoandi.id/pesanan/88421",
                "expires_in": 86400,
                "metadata": {
                  "cart_id": "9931"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "checkout_id": "k7m2q9x4tp",
                  "checkout_url": "https://pay.wasdlabs.com/checkout/k7m2q9x4tp",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "open",
                  "description": "Pesanan #88421 Kopi Panakkukang",
                  "amount": 185000,
                  "methods": ["qris", "va"],
                  "customer": {
                    "name": "Andi Saputra",
                    "phone": "081244557781",
                    "email": "andi.s@gmail.com"
                  },
                  "return_url": "https://tokoandi.id/pesanan/88421",
                  "trx_id": null,
                  "expires_at": "2026-09-21T06:21:44.000Z",
                  "paid_at": null,
                  "created_at": "2026-09-20T06:21:44.000Z",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key ini tidak terikat pada satu outlet.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "API key ini tidak terikat pada satu outlet."
                  }
                }
              }
            }
          },
          "409": {
            "description": "merchant_ref INV-88421 sudah dipakai checkout lain dengan isi berbeda.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "merchant_ref_conflict",
                    "message": "merchant_ref INV-88421 sudah dipakai checkout lain dengan isi berbeda.",
                    "field": "merchant_ref"
                  }
                }
              }
            }
          },
          "422": {
            "description": "Metode retail belum punya kanal aktif.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "channel_disabled",
                    "message": "Metode retail belum punya kanal aktif.",
                    "field": "methods"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/checkouts/{checkout_id}": {
      "get": {
        "summary": "Status satu checkout: `open` (belum dibayar), `paid`, atau `expired`. `trx_id` adalah percobaan bayar terakhir pelanggan; `null` sampai pelanggan menekan Bayar sekarang. Rate limit: 600/menit per API key.",
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "example": {
                  "checkout_id": "k7m2q9x4tp",
                  "checkout_url": "https://pay.wasdlabs.com/checkout/k7m2q9x4tp",
                  "merchant_ref": "INV-88421",
                  "outlet_id": "OTL-004",
                  "status": "paid",
                  "description": "Pesanan #88421 Kopi Panakkukang",
                  "amount": 185000,
                  "methods": ["qris", "va"],
                  "customer": {
                    "name": "Andi Saputra",
                    "phone": "081244557781",
                    "email": "andi.s@gmail.com"
                  },
                  "return_url": "https://tokoandi.id/pesanan/88421",
                  "trx_id": "WSD-5ZZTR9S",
                  "expires_at": "2026-09-21T06:21:44.000Z",
                  "paid_at": "2026-09-20T06:30:12.000Z",
                  "created_at": "2026-09-20T06:21:44.000Z",
                  "metadata": {
                    "cart_id": "9931"
                  }
                }
              }
            }
          },
          "401": {
            "description": "API key tidak valid.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "API key tidak valid."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Checkout tidak ditemukan.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Checkout tidak ditemukan."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Terlalu banyak permintaan. Coba lagi sebentar.",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Terlalu banyak permintaan. Coba lagi sebentar."
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
