# khalti/checkout-sdk-flutter architecture

> Architecture diagram of the GitHub repository khalti/checkout-sdk-flutter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khalti/checkout-sdk-flutter
- Repository: https://github.com/khalti/checkout-sdk-flutter

## Overview

This repository provides two Khalti payment integration options: a Dart REST-API layer and a Flutter checkout SDK with UI. The documented workflow is an app initiating checkout or using the API layer, with the core service communicating with Khalti. The tree identifies a WebView and client modules, but no source excerpts were available to verify finer-grained wiring.

Main entry points: [`packages/khalti_checkout_core/lib/src/data/khalti_service.dart`](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/data/khalti_service.dart) (Khalti Service), [`packages/khalti_checkout_core/lib/khalti_checkout_core.dart`](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/khalti_checkout_core.dart) (Core Entry), [`packages/khalti_checkout_flutter/lib/src/khalti_checkout_flutter.dart`](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/khalti_checkout_flutter.dart) (Checkout SDK), [`packages/khalti_checkout_core/lib/src/core/http_client/khalti_client.dart`](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/core/http_client/khalti_client.dart) (HTTP Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core API"]
  node_core_entry["Core Entry"]
  node_config["Configuration"]
  node_request["Request Model"]
  node_service["Khalti Service"]
  node_http_client["HTTP Client<br/>[khalti_client.dart]"]
  node_payment_models["Payment Models"]
end

subgraph group_flutter["Flutter Checkout"]
  node_flutter_entry["Flutter Entry"]
  node_checkout_sdk["Checkout SDK"]
  node_webview["Checkout WebView"]
  node_flutter_http["Flutter HTTP Client"]
end

subgraph group_external["External Services"]
  node_khalti_api{{"Khalti REST API"}}
end

node_merchant_app(("Merchant App"))

node_merchant_app -->|"starts checkout"| node_flutter_entry
node_merchant_app -->|"uses API"| node_core_entry
node_flutter_entry -->|"exposes"| node_checkout_sdk
node_checkout_sdk -->|"provides UI"| node_webview
node_checkout_sdk -->|"includes core"| node_core_entry
node_core_entry -->|"configures"| node_config
node_core_entry -->|"exposes"| node_service
node_service -->|"sends requests"| node_http_client
node_service -->|"uses request"| node_request
node_service -->|"uses models"| node_payment_models
node_http_client -->|"calls REST API"| node_khalti_api
node_flutter_http -.->|"HTTP access"| node_khalti_api

click node_core_entry "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/khalti_checkout_core.dart"
click node_config "https://github.com/khalti/checkout-sdk-flutter/tree/main/packages/khalti_checkout_core/lib/src/config"
click node_request "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/core/khalti_request_model.dart"
click node_service "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/data/khalti_service.dart"
click node_http_client "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/core/http_client/khalti_client.dart"
click node_payment_models "https://github.com/khalti/checkout-sdk-flutter/tree/main/packages/khalti_checkout_core/lib/src/model"
click node_flutter_entry "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/khalti_checkout_flutter.dart"
click node_checkout_sdk "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/khalti_checkout_flutter.dart"
click node_webview "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/widget/khalti_webview.dart"
click node_flutter_http "https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/data/khalti_http_client.dart"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core_entry,node_config,node_request,node_service,node_http_client,node_payment_models toneBlue
class node_flutter_entry,node_checkout_sdk,node_webview,node_flutter_http toneAmber
class node_khalti_api toneMint
class node_merchant_app toneIndigo
```

## Components

### Core API

- [Core Entry](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/khalti_checkout_core.dart): `packages/khalti_checkout_core/lib/khalti_checkout_core.dart`
- [Configuration](https://github.com/khalti/checkout-sdk-flutter/tree/main/packages/khalti_checkout_core/lib/src/config): `packages/khalti_checkout_core/lib/src/config`
- [Request Model](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/core/khalti_request_model.dart): `packages/khalti_checkout_core/lib/src/core/khalti_request_model.dart`
- [Khalti Service](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/data/khalti_service.dart): `packages/khalti_checkout_core/lib/src/data/khalti_service.dart`
- [HTTP Client](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_core/lib/src/core/http_client/khalti_client.dart): `packages/khalti_checkout_core/lib/src/core/http_client/khalti_client.dart`
- [Payment Models](https://github.com/khalti/checkout-sdk-flutter/tree/main/packages/khalti_checkout_core/lib/src/model): `packages/khalti_checkout_core/lib/src/model`

### Flutter Checkout

- [Flutter Entry](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/khalti_checkout_flutter.dart): `packages/khalti_checkout_flutter/lib/khalti_checkout_flutter.dart`
- [Checkout SDK](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/khalti_checkout_flutter.dart): `packages/khalti_checkout_flutter/lib/src/khalti_checkout_flutter.dart`
- [Checkout WebView](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/widget/khalti_webview.dart): `packages/khalti_checkout_flutter/lib/src/widget/khalti_webview.dart`
- [Flutter HTTP Client](https://github.com/khalti/checkout-sdk-flutter/blob/main/packages/khalti_checkout_flutter/lib/src/data/khalti_http_client.dart): `packages/khalti_checkout_flutter/lib/src/data/khalti_http_client.dart`

### External Services

- **Khalti REST API**

### Other components

- **Merchant App**

## Connections

- Merchant App → Flutter Entry: starts checkout
- Merchant App → Core Entry: uses API
- Flutter Entry → Checkout SDK: exposes
- Checkout SDK → Checkout WebView: provides UI
- Checkout SDK → Core Entry: includes core
- Core Entry → Configuration: configures
- Core Entry → Khalti Service: exposes
- Khalti Service → HTTP Client: sends requests
- Khalti Service → Request Model: uses request
- Khalti Service → Payment Models: uses models
- HTTP Client → Khalti REST API: calls REST API
- Flutter HTTP Client → Khalti REST API: HTTP access
