# payping/plugins-whmcs-v7x architecture

> Architecture diagram of the GitHub repository payping/plugins-whmcs-v7x, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/payping/plugins-whmcs-v7x
- Repository: https://github.com/payping/plugins-whmcs-v7x

## Overview

##### Main Components
- Payment Gateway Plugin Module – Represented by the “modules” directory, which includes two main parts:
○ The standard payment process module (modules/gateways/payping.php) that interfaces directly with WHMCS to initiate payment requests.
○ The callback module (modules/gateways/callback/payping.php) that handles the asynchronous responses or payment confirmations coming from Payping.
- External Payping Service – The external payment system that the plugin connects with (via API). This component will handle tasks like token verification and payment processing on the Payping side.
- (Optional) WHMCS Admin Panel – Since installation and configuration are performed through the WHMCS admin interface, you may include this as a component to show configuration flow (e.g., entering token, enabling/disabling Payping, etc.).

##### Relationships and Data Flow
- Once the plugin is installed into WHMCS (placing the “modules” folder to the appropriate directory), the payment gateway module is loaded by the WHMCS system.
- When a user initiates a payment, WHMCS calls the payping.php module file to communicate with the external Payping API.
- After the payment process is started, Payping later sends a callback response (to the callback/payping.php file) to WHMCS so to update the payment status.
- Configuration data (such as the token provided after installation) is stored/managed within WHMCS, which the plugin uses to authenticate with the Payping service.

##### Architectural Patterns and Key Design Elements
- Modular architecture: The plugin is packaged as a module with sub-components for different concerns (i.e., payment initiation vs. callback handling).
- Separation of Concerns: The main payment processing and callback handling are separated into different PHP files, matching real-world patterns where different endpoints manage distinct parts of the flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "WHMCS System"
        AP["WHMCS Admin Panel"]:::internal
        subgraph "Payping Payment Gateway Module"
            PI["Payment Initiation (modules/gateways/payping.php)"]:::internal
            CH["Callback Handler (modules/gateways/callback/payping.php)"]:::internal
        end
    end

    ES["Payping External Service"]:::external

    AP -->|"configures"| PI
    PI -->|"initiates payment"| ES
    ES -->|"sends callback"| CH

    click PI "https://github.com/payping/plugins-whmcs-v7x/blob/master/modules/gateways/payping.php"
    click CH "https://github.com/payping/plugins-whmcs-v7x/blob/master/modules/gateways/callback/payping.php"

    classDef internal fill:#cde,stroke:#333,stroke-width:2px
    classDef external fill:#fdd,stroke:#333,stroke-width:2px
```
