# mynkdev-21/upi-gateway architecture

> Architecture diagram of the GitHub repository mynkdev-21/upi-gateway, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mynkdev-21/upi-gateway
- Repository: https://github.com/mynkdev-21/upi-gateway

## Overview

UPI Gateway is a self-hosted multi-merchant payment platform. Merchants create Live or Sandbox orders through the API or dashboard; orders select a compatible account, present hosted checkout or UPI payment, undergo provider or manual verification, and produce signed webhook notifications. Merchant account and administration features, webhook history/retention, and browser installation are also represented. Relationships are limited to calls and setup wiring shown in excerpts, the source index, or README; several controller and integration paths are tree-supported but unsampled.

Main entry points: [`app/Services/OrderService.php`](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/OrderService.php) (Order orchestration), [`app/Http/Controllers/Api/OrderApiController.php`](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Api/OrderApiController.php) (Merchant API), [`bootstrap/app.php`](https://github.com/mynkdev-21/upi-gateway/blob/main/bootstrap/app.php) (Web runtime), [`app/Jobs/SendWebhook.php`](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Jobs/SendWebhook.php) (Webhook sender)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_merchant_api["Merchant API"]
  node_web_runtime["Web runtime<br/>[app.php]"]
  node_auth["API key auth"]
end

subgraph group_merchant["Merchant operations"]
  node_accounts_ui["Account management"]
  node_account["Payment accounts<br/>[PaymentAccount.php]"]
  node_merchant_user[("Merchant identity<br/>[User.php]")]
  node_orders_ui["Order dashboard"]
  node_order_api["Order API"]
end

subgraph group_payments["Payment lifecycle"]
  node_order_service["Order orchestration<br/>[OrderService.php]"]
  node_order_store[("Orders<br/>[Order.php]")]
  node_checkout["Checkout"]
  node_sandbox["Sandbox checkout"]
  node_verification["Payment verification"]
end

subgraph group_webhooks["Webhook delivery"]
  node_webhook_outbox_service["Webhook event creation"]
  node_outbox[("Webhook outbox<br/>[WebhookOutbox.php]")]
  node_dispatcher["Webhook dispatch"]
  node_send_webhook["Webhook sender<br/>[SendWebhook.php]"]
  node_webhook_history["Webhook history"]
  node_webhook_logs[("Delivery logs<br/>[WebhookLog.php]")]
end

subgraph group_operations["Administration and setup"]
  node_admin["Admin dashboard"]
  node_debugger["Transaction debugger"]
  node_audit[("Admin audit<br/>[AdminAuditLog.php]")]
  node_retention["Webhook retention"]
  node_installer["Browser installer"]
  node_install_manager["Installation manager"]
  node_deployment_url["Deployment URL<br/>[DeploymentUrl.php]"]
end

node_merchant(("Merchant"))
node_customer(("Payer"))
node_provider(("Payment providers"))
node_merchant_endpoint(("Merchant endpoint"))

node_merchant -.->|"uses"| node_web_runtime
node_web_runtime -->|"registers middleware"| node_auth
node_merchant -.->|"creates orders"| node_merchant_api
node_merchant_api -->|"delegates"| node_order_service
node_merchant_api -->|"authenticates"| node_merchant_user
node_merchant -.->|"manages accounts"| node_accounts_ui
node_accounts_ui -.->|"manages"| node_account
node_merchant -.->|"tracks orders"| node_orders_ui
node_orders_ui -.->|"delegates"| node_order_service
node_order_service -->|"selects account"| node_account
node_order_service -->|"creates and checks"| node_order_store
node_order_service -->|"runs verifier"| node_verification
node_customer -.->|"pays"| node_checkout
node_checkout -.->|"checks payment"| node_order_service
node_customer -.->|"tests payment"| node_sandbox
node_sandbox -.->|"uses"| node_order_service
node_verification -.->|"verifies with"| node_provider
node_order_service -->|"records events"| node_webhook_outbox_service
node_webhook_outbox_service -.->|"writes events"| node_outbox
node_dispatcher -.->|"claims events"| node_outbox
node_dispatcher -.->|"dispatches job"| node_send_webhook
node_send_webhook -.->|"sends signed webhook"| node_merchant_endpoint
node_send_webhook -->|"records delivery"| node_webhook_logs
node_debugger -->|"loads history"| node_webhook_history
node_webhook_history -->|"reads delivery history"| node_webhook_logs
node_admin -->|"uses order service"| node_order_service
node_admin -.->|"writes audit"| node_audit
node_debugger -->|"writes audit"| node_audit
node_retention -.->|"archives logs"| node_webhook_logs
node_installer -->|"runs setup"| node_install_manager
node_installer -->|"uses URL config"| node_deployment_url
node_web_runtime -->|"routes requests"| node_installer

click node_merchant_api "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Api/OrderApiController.php"
click node_web_runtime "https://github.com/mynkdev-21/upi-gateway/blob/main/bootstrap/app.php"
click node_auth "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Middleware/AuthenticateApiKey.php"
click node_accounts_ui "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/PaymentAccountController.php"
click node_account "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/PaymentAccount.php"
click node_merchant_user "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/User.php"
click node_orders_ui "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/OrderController.php"
click node_order_api "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Api/OrderApiController.php"
click node_order_service "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/OrderService.php"
click node_order_store "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/Order.php"
click node_checkout "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/CheckoutController.php"
click node_sandbox "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/SandboxCheckoutController.php"
click node_verification "https://github.com/mynkdev-21/upi-gateway/tree/main/app/Services/Verifiers"
click node_webhook_outbox_service "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookOutboxService.php"
click node_outbox "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/WebhookOutbox.php"
click node_dispatcher "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookOutboxDispatcher.php"
click node_send_webhook "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Jobs/SendWebhook.php"
click node_webhook_history "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookHistoryService.php"
click node_webhook_logs "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/WebhookLog.php"
click node_admin "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Admin/AdminController.php"
click node_debugger "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Admin/TransactionDebuggerController.php"
click node_audit "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/AdminAuditLog.php"
click node_retention "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookRetentionService.php"
click node_installer "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/InstallController.php"
click node_install_manager "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Support/InstallationManager.php"
click node_deployment_url "https://github.com/mynkdev-21/upi-gateway/blob/main/app/Support/DeploymentUrl.php"

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_merchant_api,node_web_runtime,node_auth toneBlue
class node_accounts_ui,node_account,node_merchant_user,node_orders_ui,node_order_api toneAmber
class node_order_service,node_order_store,node_checkout,node_sandbox,node_verification toneMint
class node_webhook_outbox_service,node_outbox,node_dispatcher,node_send_webhook,node_webhook_history,node_webhook_logs toneRose
class node_admin,node_debugger,node_audit,node_retention,node_installer,node_install_manager,node_deployment_url,node_merchant,node_customer,node_provider,node_merchant_endpoint toneIndigo
```

## Components

### Application entry

- [Merchant API](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Api/OrderApiController.php): `app/Http/Controllers/Api/OrderApiController.php`
- [Web runtime](https://github.com/mynkdev-21/upi-gateway/blob/main/bootstrap/app.php): `bootstrap/app.php`
- [API key auth](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Middleware/AuthenticateApiKey.php): `app/Http/Middleware/AuthenticateApiKey.php`

### Merchant operations

- [Account management](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/PaymentAccountController.php): `app/Http/Controllers/PaymentAccountController.php`
- [Payment accounts](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/PaymentAccount.php): `app/Models/PaymentAccount.php`
- [Merchant identity](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/User.php): `app/Models/User.php`
- [Order dashboard](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/OrderController.php): `app/Http/Controllers/OrderController.php`
- [Order API](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Api/OrderApiController.php): `app/Http/Controllers/Api/OrderApiController.php`

### Payment lifecycle

- [Order orchestration](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/OrderService.php): `app/Services/OrderService.php`
- [Orders](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/Order.php): `app/Models/Order.php`
- [Checkout](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/CheckoutController.php): `app/Http/Controllers/CheckoutController.php`
- [Sandbox checkout](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/SandboxCheckoutController.php): `app/Http/Controllers/SandboxCheckoutController.php`
- [Payment verification](https://github.com/mynkdev-21/upi-gateway/tree/main/app/Services/Verifiers): `app/Services/Verifiers`

### Webhook delivery

- [Webhook event creation](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookOutboxService.php): `app/Services/WebhookOutboxService.php`
- [Webhook outbox](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/WebhookOutbox.php): `app/Models/WebhookOutbox.php`
- [Webhook dispatch](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookOutboxDispatcher.php): `app/Services/WebhookOutboxDispatcher.php`
- [Webhook sender](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Jobs/SendWebhook.php): `app/Jobs/SendWebhook.php`
- [Webhook history](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookHistoryService.php): `app/Services/WebhookHistoryService.php`
- [Delivery logs](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/WebhookLog.php): `app/Models/WebhookLog.php`

### Administration and setup

- [Admin dashboard](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Admin/AdminController.php): `app/Http/Controllers/Admin/AdminController.php`
- [Transaction debugger](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/Admin/TransactionDebuggerController.php): `app/Http/Controllers/Admin/TransactionDebuggerController.php`
- [Admin audit](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Models/AdminAuditLog.php): `app/Models/AdminAuditLog.php`
- [Webhook retention](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Services/WebhookRetentionService.php): `app/Services/WebhookRetentionService.php`
- [Browser installer](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Http/Controllers/InstallController.php): `app/Http/Controllers/InstallController.php`
- [Installation manager](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Support/InstallationManager.php): `app/Support/InstallationManager.php`
- [Deployment URL](https://github.com/mynkdev-21/upi-gateway/blob/main/app/Support/DeploymentUrl.php): `app/Support/DeploymentUrl.php`

### Other components

- **Merchant**
- **Payer**
- **Payment providers**
- **Merchant endpoint**

## Connections

- Merchant → Web runtime: uses
- Web runtime → API key auth: registers middleware (evidence: `bootstrap/app.php`)
- Merchant → Merchant API: creates orders
- Merchant API → Order orchestration: delegates (evidence: `app/Http/Controllers/Api/OrderApiController.php`)
- Merchant API → Merchant identity: authenticates (evidence: `app/Http/Controllers/Api/OrderApiController.php`)
- Merchant → Account management: manages accounts
- Account management → Payment accounts: manages
- Merchant → Order dashboard: tracks orders
- Order dashboard → Order orchestration: delegates
- Order orchestration → Payment accounts: selects account (evidence: `app/Services/OrderService.php`)
- Order orchestration → Orders: creates and checks (evidence: `app/Services/OrderService.php`)
- Order orchestration → Payment verification: runs verifier (evidence: `app/Services/OrderService.php`)
- Payer → Checkout: pays
- Checkout → Order orchestration: checks payment
- Payer → Sandbox checkout: tests payment
- Sandbox checkout → Order orchestration: uses
- Payment verification → Payment providers: verifies with
- Order orchestration → Webhook event creation: records events (evidence: `app/Services/OrderService.php`)
- Webhook event creation → Webhook outbox: writes events
- Webhook dispatch → Webhook outbox: claims events
- Webhook dispatch → Webhook sender: dispatches job
- Webhook sender → Merchant endpoint: sends signed webhook (evidence: `app/Jobs/SendWebhook.php`)
- Webhook sender → Delivery logs: records delivery (evidence: `app/Jobs/SendWebhook.php`)
- Transaction debugger → Webhook history: loads history (evidence: `app/Http/Controllers/Admin/TransactionDebuggerController.php`)
- Webhook history → Delivery logs: reads delivery history (evidence: `app/Services/WebhookHistoryService.php`)
- Admin dashboard → Order orchestration: uses order service (evidence: `app/Http/Controllers/Admin/AdminController.php`)
- Admin dashboard → Admin audit: writes audit (evidence: `app/Http/Controllers/Admin/AdminController.php`)
- Transaction debugger → Admin audit: writes audit (evidence: `app/Http/Controllers/Admin/TransactionDebuggerController.php`)
- Webhook retention → Delivery logs: archives logs
- Browser installer → Installation manager: runs setup (evidence: `app/Http/Controllers/InstallController.php`)
- Browser installer → Deployment URL: uses URL config (evidence: `app/Http/Controllers/InstallController.php`)
- Web runtime → Browser installer: routes requests (evidence: `bootstrap/app.php`)
