# vkprajapati/payment-orchestrator architecture

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

- Interactive diagram: https://gitdiagram.com/vkprajapati/payment-orchestrator
- Repository: https://github.com/vkprajapati/payment-orchestrator

## Overview

This Laravel application provides merchant-scoped payment operations, API-key management, audit records, and dashboard views. A typical test-checkout request reaches a controller, creates an idempotent payment, and can submit it for provider processing; refunds and hosted Stripe checkout are separate branches. The API also exposes payment, refund, audit, and key-management capabilities. Relationships below are limited to controller calls and dependencies listed in the supplied excerpts or SOURCE INDEX; routes and several implementation details were not sampled.

Main entry points: [`app/Http/Controllers/TestCheckoutController.php`](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/TestCheckoutController.php) (Test checkout), [`app/Http/Controllers/Api/V1/RefundController.php`](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/RefundController.php) (Refund API), [`app/Http/Controllers/Api/V1/ApiKeyController.php`](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/ApiKeyController.php) (API key API), [`app/Services/Audit/AuditLogger.php`](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Audit/AuditLogger.php) (Audit logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request handling"]
  node_test_checkout["Test checkout"]
  node_payment_api["Payment API"]
  node_refund_api["Refund API"]
  node_key_api["API key API"]
end

subgraph group_payments["Payment lifecycle"]
  node_payment_create["Payment creation"]
  node_payment_process["Payment processing"]
  node_checkout_session["Hosted checkout"]
  node_refund_process["Refund processing<br/>[ProcessRefund.php]"]
  node_payment_webhook["Webhook reconciliation"]
  node_provider_registry["Provider registry"]
  node_webhook_registry["Webhook registry"]
  node_provider_setup["Provider setup"]
  node_provider_adapters["Payment providers"]
  node_payment_model[("Payment records<br/>[Payment.php]")]
end

subgraph group_access["Merchant access"]
  node_merchant_context["Current merchant"]
  node_api_key_actions["Key management<br/>[CreateApiKey.php]"]
  node_api_auth["API key context"]
  node_api_idempotency["Request idempotency"]
  node_merchant_model[("Merchant records<br/>[Merchant.php]")]
end

subgraph group_audit["Audit operations"]
  node_audit_logger["Audit logging<br/>[AuditLogger.php]"]
  node_audit_actions["Audit retention and metrics"]
end

subgraph group_presentation["Merchant interface"]
  node_payment_dashboard["Payment dashboard"]
  node_dashboard_data["Merchant dashboard"]
end

node_merchant_actor(("Merchant user"))
node_api_client(("API client"))

node_merchant_actor -->|"submits checkout"| node_test_checkout
node_api_client -.->|"requests payment"| node_payment_api
node_api_client -.->|"requests refund"| node_refund_api
node_api_client -->|"manages keys"| node_key_api
node_test_checkout -->|"creates idempotently"| node_payment_create
node_test_checkout -->|"processes payment"| node_payment_process
node_test_checkout -->|"starts checkout"| node_checkout_session
node_test_checkout -->|"processes refund"| node_refund_process
node_test_checkout -->|"records events"| node_audit_logger
node_test_checkout -.->|"resolves merchant"| node_merchant_context
node_payment_api -.->|"wraps requests"| node_api_idempotency
node_refund_api -->|"wraps requests"| node_api_idempotency
node_refund_api -->|"processes refund"| node_refund_process
node_refund_api -->|"records events"| node_audit_logger
node_key_api -->|"wraps creation"| node_api_idempotency
node_key_api -->|"manages keys"| node_api_key_actions
node_key_api -->|"records events"| node_audit_logger
node_payment_create -->|"creates payment"| node_payment_model
node_payment_api -->|"uses request context"| node_api_auth
node_provider_setup -->|"registers providers"| node_provider_registry
node_provider_setup -->|"registers handlers"| node_webhook_registry
node_provider_setup -->|"configures providers"| node_provider_adapters
node_webhook_registry -.->|"resolves webhook provider"| node_payment_webhook
node_payment_dashboard -->|"resolves merchant"| node_merchant_context
node_payment_dashboard -->|"queries payments"| node_payment_model
node_audit_actions -.->|"maintains audit data"| node_audit_logger

click node_test_checkout "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/TestCheckoutController.php"
click node_payment_api "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/PaymentController.php"
click node_refund_api "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/RefundController.php"
click node_key_api "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/ApiKeyController.php"
click node_payment_create "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/CreateIdempotentPayment.php"
click node_payment_process "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ProcessPaymentWithFailover.php"
click node_checkout_session "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/InitiateStripeCheckout.php"
click node_refund_process "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ProcessRefund.php"
click node_payment_webhook "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ReconcilePaymentWebhook.php"
click node_provider_registry "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Payments/PaymentProviderManager.php"
click node_webhook_registry "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Payments/PaymentWebhookManager.php"
click node_provider_setup "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Providers/PaymentServiceProvider.php"
click node_provider_adapters "https://github.com/vkprajapati/payment-orchestrator/tree/main/app/Services/Payments/Providers"
click node_merchant_context "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Merchants/CurrentMerchant.php"
click node_api_key_actions "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/ApiKeys/CreateApiKey.php"
click node_api_auth "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/ApiKeys/ApiRequestContext.php"
click node_api_idempotency "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Api/HandleIdempotentRequest.php"
click node_audit_logger "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Audit/AuditLogger.php"
click node_audit_actions "https://github.com/vkprajapati/payment-orchestrator/tree/main/app/Actions/Audit"
click node_payment_dashboard "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/PaymentDashboardController.php"
click node_dashboard_data "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Dashboard/GetMerchantDashboard.php"
click node_payment_model "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Models/Payment.php"
click node_merchant_model "https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Models/Merchant.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_test_checkout,node_payment_api,node_refund_api,node_key_api,node_merchant_actor,node_api_client toneBlue
class node_payment_create,node_payment_process,node_checkout_session,node_refund_process,node_payment_webhook,node_provider_registry,node_webhook_registry,node_provider_setup,node_provider_adapters,node_payment_model toneAmber
class node_merchant_context,node_api_key_actions,node_api_auth,node_api_idempotency,node_merchant_model toneMint
class node_audit_logger,node_audit_actions toneRose
class node_payment_dashboard,node_dashboard_data toneIndigo
```

## Components

### Request handling

- [Test checkout](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/TestCheckoutController.php): `app/Http/Controllers/TestCheckoutController.php`
- [Payment API](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/PaymentController.php): `app/Http/Controllers/Api/V1/PaymentController.php`
- [Refund API](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/RefundController.php): `app/Http/Controllers/Api/V1/RefundController.php`
- [API key API](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/Api/V1/ApiKeyController.php): `app/Http/Controllers/Api/V1/ApiKeyController.php`

### Payment lifecycle

- [Payment creation](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/CreateIdempotentPayment.php): `app/Actions/Payments/CreateIdempotentPayment.php`
- [Payment processing](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ProcessPaymentWithFailover.php): `app/Actions/Payments/ProcessPaymentWithFailover.php`
- [Hosted checkout](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/InitiateStripeCheckout.php): `app/Actions/Payments/InitiateStripeCheckout.php`
- [Refund processing](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ProcessRefund.php): `app/Actions/Payments/ProcessRefund.php`
- [Webhook reconciliation](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Payments/ReconcilePaymentWebhook.php): `app/Actions/Payments/ReconcilePaymentWebhook.php`
- [Provider registry](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Payments/PaymentProviderManager.php): `app/Services/Payments/PaymentProviderManager.php`
- [Webhook registry](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Payments/PaymentWebhookManager.php): `app/Services/Payments/PaymentWebhookManager.php`
- [Provider setup](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Providers/PaymentServiceProvider.php): `app/Providers/PaymentServiceProvider.php`
- [Payment providers](https://github.com/vkprajapati/payment-orchestrator/tree/main/app/Services/Payments/Providers): `app/Services/Payments/Providers`
- [Payment records](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Models/Payment.php): `app/Models/Payment.php`

### Merchant access

- [Current merchant](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Merchants/CurrentMerchant.php): `app/Services/Merchants/CurrentMerchant.php`
- [Key management](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/ApiKeys/CreateApiKey.php): `app/Actions/ApiKeys/CreateApiKey.php`
- [API key context](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/ApiKeys/ApiRequestContext.php): `app/Services/ApiKeys/ApiRequestContext.php`
- [Request idempotency](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Api/HandleIdempotentRequest.php): `app/Actions/Api/HandleIdempotentRequest.php`
- [Merchant records](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Models/Merchant.php): `app/Models/Merchant.php`

### Audit operations

- [Audit logging](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Services/Audit/AuditLogger.php): `app/Services/Audit/AuditLogger.php`
- [Audit retention and metrics](https://github.com/vkprajapati/payment-orchestrator/tree/main/app/Actions/Audit): `app/Actions/Audit`

### Merchant interface

- [Payment dashboard](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Http/Controllers/PaymentDashboardController.php): `app/Http/Controllers/PaymentDashboardController.php`
- [Merchant dashboard](https://github.com/vkprajapati/payment-orchestrator/blob/main/app/Actions/Dashboard/GetMerchantDashboard.php): `app/Actions/Dashboard/GetMerchantDashboard.php`

### Other components

- **Merchant user**
- **API client**

## Connections

- Merchant user → Test checkout: submits checkout (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- API client → Payment API: requests payment
- API client → Refund API: requests refund
- API client → API key API: manages keys (evidence: `app/Http/Controllers/Api/V1/ApiKeyController.php`)
- Test checkout → Payment creation: creates idempotently (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Test checkout → Payment processing: processes payment (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Test checkout → Hosted checkout: starts checkout (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Test checkout → Refund processing: processes refund (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Test checkout → Audit logging: records events (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Test checkout → Current merchant: resolves merchant (evidence: `app/Http/Controllers/TestCheckoutController.php`)
- Payment API → Request idempotency: wraps requests
- Refund API → Request idempotency: wraps requests (evidence: `app/Http/Controllers/Api/V1/RefundController.php`)
- Refund API → Refund processing: processes refund (evidence: `app/Http/Controllers/Api/V1/RefundController.php`)
- Refund API → Audit logging: records events (evidence: `app/Http/Controllers/Api/V1/RefundController.php`)
- API key API → Request idempotency: wraps creation (evidence: `app/Http/Controllers/Api/V1/ApiKeyController.php`)
- API key API → Key management: manages keys (evidence: `app/Http/Controllers/Api/V1/ApiKeyController.php`)
- API key API → Audit logging: records events (evidence: `app/Http/Controllers/Api/V1/ApiKeyController.php`)
- Payment creation → Payment records: creates payment
- Payment API → API key context: uses request context
- Provider setup → Provider registry: registers providers (evidence: `app/Providers/PaymentServiceProvider.php`)
- Provider setup → Webhook registry: registers handlers (evidence: `app/Providers/PaymentServiceProvider.php`)
- Provider setup → Payment providers: configures providers (evidence: `app/Providers/PaymentServiceProvider.php`)
- Webhook registry → Webhook reconciliation: resolves webhook provider
- Payment dashboard → Current merchant: resolves merchant (evidence: `app/Http/Controllers/PaymentDashboardController.php`)
- Payment dashboard → Payment records: queries payments (evidence: `app/Http/Controllers/PaymentDashboardController.php`)
- Audit retention and metrics → Audit logging: maintains audit data
