# nhwin304/momo-payment architecture

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

- Interactive diagram: https://gitdiagram.com/nhwin304/momo-payment
- Repository: https://github.com/nhwin304/momo-payment

## Overview

This Laravel package provides MoMo v2 payment creation, transaction queries, and IPN verification, with a Filament admin page for global gateway settings. The main workflow is an application calling the payment service, which loads credentials and endpoints, signs requests, and exchanges them with MoMo; the application remains responsible for orders and IPN routes. The graph includes documented query and IPN capabilities. Relationships are limited to excerpted calls and README statements; no application-owned order or callback controller is present in this repository.

Main entry points: [`src/Services/MoMoPaymentService.php`](https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoPaymentService.php) (Payment service), [`src/Filament/Pages/MoMoSettingsPage.php`](https://github.com/nhwin304/momo-payment/blob/main/src/Filament/Pages/MoMoSettingsPage.php) (Settings page), [`src/Services/MoMoConfiguration.php`](https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoConfiguration.php) (Credential config), [`src/MoMoPaymentServiceProvider.php`](https://github.com/nhwin304/momo-payment/blob/main/src/MoMoPaymentServiceProvider.php) (Service provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Payment runtime"]
  node_service["Payment service"]
  node_config["Credential config"]
  node_signer["HMAC signer<br/>[MoMoSigner.php]"]
  node_exception["Payment errors"]
end

subgraph group_admin["Admin settings"]
  node_plugin["Filament plugin<br/>[MoMoPlugin.php]"]
  node_page["Settings page"]
  node_view["Settings form view"]
  node_validator["Settings validator"]
  node_definition["Settings definition"]
end

subgraph group_integration["Package integration"]
  node_provider["Service provider"]
  node_appconfig["Package config<br/>[momo-payment.php]"]
end

node_app(("Laravel application"))
node_momo{{"MoMo API"}}
node_adminuser(("Admin user"))
node_settingsstore[("Settings store")]

node_app -->|"calls"| node_service
node_service -->|"loads credentials"| node_config
node_service -->|"signs requests"| node_signer
node_service -->|"posts create/query"| node_momo
node_service -->|"selects endpoint"| node_config
node_service -->|"throws errors"| node_exception
node_service -->|"verifies IPN"| node_signer
node_adminuser -->|"registers"| node_plugin
node_plugin -->|"registers page"| node_page
node_page -->|"renders"| node_view
node_page -->|"validates saves"| node_validator
node_page -->|"loads defaults"| node_definition
node_page -->|"reads/writes global"| node_settingsstore
node_config -->|"reads credentials"| node_settingsstore
node_provider -->|"merges config"| node_appconfig
node_provider -->|"registers definition"| node_definition
node_provider -->|"binds service"| node_config
node_config -->|"selects endpoints"| node_appconfig
node_definition -->|"defines encrypted fields"| node_settingsstore
node_app -->|"checks transactions"| node_service
node_app -->|"verifies IPN"| node_service

click node_service "https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoPaymentService.php"
click node_config "https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoConfiguration.php"
click node_signer "https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoSigner.php"
click node_exception "https://github.com/nhwin304/momo-payment/blob/main/src/Exceptions/MoMoPaymentException.php"
click node_plugin "https://github.com/nhwin304/momo-payment/blob/main/src/Filament/MoMoPlugin.php"
click node_page "https://github.com/nhwin304/momo-payment/blob/main/src/Filament/Pages/MoMoSettingsPage.php"
click node_view "https://github.com/nhwin304/momo-payment/blob/main/resources/views/filament/pages/momo-settings.blade.php"
click node_validator "https://github.com/nhwin304/momo-payment/blob/main/src/Settings/MoMoSettingsValidator.php"
click node_definition "https://github.com/nhwin304/momo-payment/blob/main/src/Settings/MoMoSettingsDefinition.php"
click node_provider "https://github.com/nhwin304/momo-payment/blob/main/src/MoMoPaymentServiceProvider.php"
click node_appconfig "https://github.com/nhwin304/momo-payment/blob/main/config/momo-payment.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_service,node_config,node_signer,node_exception,node_adminuser toneBlue
class node_plugin,node_page,node_view,node_validator,node_definition,node_settingsstore toneAmber
class node_provider,node_appconfig,node_momo toneMint
class node_app toneIndigo
```

## Components

### Payment runtime

- [Payment service](https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoPaymentService.php): `src/Services/MoMoPaymentService.php`
- [Credential config](https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoConfiguration.php): `src/Services/MoMoConfiguration.php`
- [HMAC signer](https://github.com/nhwin304/momo-payment/blob/main/src/Services/MoMoSigner.php): `src/Services/MoMoSigner.php`
- [Payment errors](https://github.com/nhwin304/momo-payment/blob/main/src/Exceptions/MoMoPaymentException.php): `src/Exceptions/MoMoPaymentException.php`

### Admin settings

- [Filament plugin](https://github.com/nhwin304/momo-payment/blob/main/src/Filament/MoMoPlugin.php): `src/Filament/MoMoPlugin.php`
- [Settings page](https://github.com/nhwin304/momo-payment/blob/main/src/Filament/Pages/MoMoSettingsPage.php): `src/Filament/Pages/MoMoSettingsPage.php`
- [Settings form view](https://github.com/nhwin304/momo-payment/blob/main/resources/views/filament/pages/momo-settings.blade.php): `resources/views/filament/pages/momo-settings.blade.php`
- [Settings validator](https://github.com/nhwin304/momo-payment/blob/main/src/Settings/MoMoSettingsValidator.php): `src/Settings/MoMoSettingsValidator.php`
- [Settings definition](https://github.com/nhwin304/momo-payment/blob/main/src/Settings/MoMoSettingsDefinition.php): `src/Settings/MoMoSettingsDefinition.php`

### Package integration

- [Service provider](https://github.com/nhwin304/momo-payment/blob/main/src/MoMoPaymentServiceProvider.php): `src/MoMoPaymentServiceProvider.php`
- [Package config](https://github.com/nhwin304/momo-payment/blob/main/config/momo-payment.php): `config/momo-payment.php`

### Other components

- **Laravel application**
- **MoMo API**
- **Admin user**
- **Settings store**

## Connections

- Laravel application → Payment service: calls (evidence: `README.md`)
- Payment service → Credential config: loads credentials (evidence: `src/Services/MoMoPaymentService.php`)
- Payment service → HMAC signer: signs requests (evidence: `src/Services/MoMoPaymentService.php`)
- Payment service → MoMo API: posts create/query (evidence: `src/Services/MoMoPaymentService.php`)
- Payment service → Credential config: selects endpoint (evidence: `src/Services/MoMoPaymentService.php`)
- Payment service → Payment errors: throws errors (evidence: `src/Services/MoMoPaymentService.php`)
- Payment service → HMAC signer: verifies IPN (evidence: `src/Services/MoMoPaymentService.php`)
- Admin user → Filament plugin: registers (evidence: `README.md`)
- Filament plugin → Settings page: registers page (evidence: `src/Filament/MoMoPlugin.php`)
- Settings page → Settings form view: renders (evidence: `src/Filament/Pages/MoMoSettingsPage.php`)
- Settings page → Settings validator: validates saves (evidence: `src/Filament/Pages/MoMoSettingsPage.php`)
- Settings page → Settings definition: loads defaults (evidence: `src/Filament/Pages/MoMoSettingsPage.php`)
- Settings page → Settings store: reads/writes global (evidence: `src/Filament/Pages/MoMoSettingsPage.php`)
- Credential config → Settings store: reads credentials (evidence: `src/Services/MoMoConfiguration.php`)
- Service provider → Package config: merges config (evidence: `src/MoMoPaymentServiceProvider.php`)
- Service provider → Settings definition: registers definition (evidence: `src/MoMoPaymentServiceProvider.php`)
- Service provider → Credential config: binds service (evidence: `src/MoMoPaymentServiceProvider.php`)
- Credential config → Package config: selects endpoints (evidence: `src/Services/MoMoConfiguration.php`)
- Settings definition → Settings store: defines encrypted fields (evidence: `src/Settings/MoMoSettingsDefinition.php`)
- Laravel application → Payment service: checks transactions (evidence: `README.md`)
- Laravel application → Payment service: verifies IPN (evidence: `README.md`)
