# lelledev/upaygo architecture

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

- Interactive diagram: https://gitdiagram.com/lelledev/upaygo
- Repository: https://github.com/lelledev/upaygo

## Overview

uPayGo is a stateless Go payment-gateway microservice that exposes REST operations for Stripe Payment Intents. The main workflow creates an intent, confirms it for authentication (including possible 3D Secure), then captures it after checkout succeeds or cancels it on failure; clients can also retrieve intent status. Amount, currency, customer, and payment-source types form the domain layer, while configuration selects Stripe clients by currency. The README documents these capabilities; some action and configuration links rely on its description because their implementation excerpts were not shown.

Main entry points: [`payment/intent/create/intentcreate.go`](https://github.com/lelledev/upaygo/blob/main/payment/intent/create/intentcreate.go) (Create Intent), [`config/stripe_client.go`](https://github.com/lelledev/upaygo/blob/main/config/stripe_client.go) (Stripe Clients), [`main.go`](https://github.com/lelledev/upaygo/blob/main/main.go) (HTTP Server), [`payment/intent/stripeconv.go`](https://github.com/lelledev/upaygo/blob/main/payment/intent/stripeconv.go) (Stripe Conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["HTTP Server<br/>[main.go]"]
  node_create_handler["Create Handler"]
  node_confirm_handler["Confirm Handler"]
  node_capture_handler["Capture Handler"]
  node_cancel_handler["Cancel Handler"]
  node_get_handler["Get Handler<br/>[restintentget.go]"]
end

subgraph group_intent["Intent Operations"]
  node_create["Create Intent<br/>[intentcreate.go]"]
  node_confirm["Confirm Intent<br/>[intentconfirm.go]"]
  node_capture["Capture Intent<br/>[intentcapture.go]"]
  node_cancel["Cancel Intent<br/>[intentcancel.go]"]
  node_get["Retrieve Intent<br/>[intentget.go]"]
end

subgraph group_domain["Payment Domain"]
  node_intent_model["Intent Model<br/>[intent.go]"]
  node_stripe_conversion["Stripe Conversion<br/>[stripeconv.go]"]
  node_amount["Amount<br/>[amount.go]"]
  node_currency["Currency<br/>[currency.go]"]
  node_customer["Customer<br/>[customer.go]"]
  node_stripe_customer["Stripe Customer<br/>[customerstripe.go]"]
  node_source["Payment Source<br/>[paymentsource.go]"]
end

subgraph group_infra["Gateway Configuration"]
  node_config["App Configuration<br/>[config.go]"]
  node_stripe_config["Stripe Clients<br/>[stripe_client.go]"]
end

node_client(("Payment Client"))
node_stripe["Stripe API"]

node_client -->|"sends requests"| node_server
node_server -->|"routes requests"| node_create_handler
node_server -->|"routes requests"| node_confirm_handler
node_server -->|"routes requests"| node_capture_handler
node_server -->|"routes requests"| node_cancel_handler
node_server -->|"routes requests"| node_get_handler
node_create_handler -->|"creates intent"| node_create
node_confirm_handler -->|"confirms intent"| node_confirm
node_capture_handler -->|"captures intent"| node_capture
node_cancel_handler -->|"cancels intent"| node_cancel
node_get_handler -->|"retrieves intent"| node_get
node_create -->|"selects client"| node_stripe_config
node_confirm -->|"selects client"| node_stripe_config
node_capture -->|"selects client"| node_stripe_config
node_cancel -->|"selects client"| node_stripe_config
node_get -->|"selects client"| node_stripe_config
node_stripe_customer -->|"selects client"| node_stripe_config
node_create -->|"creates payment intent"| node_stripe
node_confirm -->|"confirms payment intent"| node_stripe
node_capture -->|"captures payment intent"| node_stripe
node_cancel -.->|"manages payment intent"| node_stripe
node_get -.->|"retrieves payment intent"| node_stripe
node_stripe_customer -->|"creates customer"| node_stripe
node_create -->|"uses amount"| node_amount
node_create -->|"uses customer"| node_customer
node_create -->|"uses source"| node_source
node_amount -->|"uses currency"| node_currency
node_create -->|"builds intent"| node_intent_model
node_confirm -->|"builds intent"| node_intent_model
node_capture -->|"builds intent"| node_intent_model
node_stripe_conversion -->|"constructs model"| node_intent_model
node_stripe_conversion -->|"maps amount"| node_amount
node_stripe_conversion -->|"maps customer"| node_customer
node_stripe_conversion -->|"maps source"| node_source
node_config -.->|"provides settings"| node_stripe_config
node_stripe_config -->|"configures credentials"| node_stripe

click node_server "https://github.com/lelledev/upaygo/blob/main/main.go"
click node_create_handler "https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/create/restintentcreate.go"
click node_confirm_handler "https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/confirm/restintentconfirm.go"
click node_capture_handler "https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/capture/restintentcapture.go"
click node_cancel_handler "https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/cancel/restintentcancel.go"
click node_get_handler "https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/get/restintentget.go"
click node_create "https://github.com/lelledev/upaygo/blob/main/payment/intent/create/intentcreate.go"
click node_confirm "https://github.com/lelledev/upaygo/blob/main/payment/intent/confirm/intentconfirm.go"
click node_capture "https://github.com/lelledev/upaygo/blob/main/payment/intent/capture/intentcapture.go"
click node_cancel "https://github.com/lelledev/upaygo/blob/main/payment/intent/cancel/intentcancel.go"
click node_get "https://github.com/lelledev/upaygo/blob/main/payment/intent/get/intentget.go"
click node_intent_model "https://github.com/lelledev/upaygo/blob/main/payment/intent/intent.go"
click node_stripe_conversion "https://github.com/lelledev/upaygo/blob/main/payment/intent/stripeconv.go"
click node_amount "https://github.com/lelledev/upaygo/blob/main/amount/amount.go"
click node_currency "https://github.com/lelledev/upaygo/blob/main/currency/currency.go"
click node_customer "https://github.com/lelledev/upaygo/blob/main/customer/customer.go"
click node_stripe_customer "https://github.com/lelledev/upaygo/blob/main/customer/customerstripe.go"
click node_source "https://github.com/lelledev/upaygo/blob/main/payment/source/paymentsource.go"
click node_config "https://github.com/lelledev/upaygo/blob/main/config/config.go"
click node_stripe_config "https://github.com/lelledev/upaygo/blob/main/config/stripe_client.go"

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_server,node_create_handler,node_confirm_handler,node_capture_handler,node_cancel_handler,node_get_handler,node_client toneBlue
class node_create,node_confirm,node_capture,node_cancel,node_get toneAmber
class node_intent_model,node_stripe_conversion,node_amount,node_currency,node_customer,node_stripe_customer,node_source,node_stripe toneMint
class node_config,node_stripe_config toneRose
```

## Components

### HTTP API

- [HTTP Server](https://github.com/lelledev/upaygo/blob/main/main.go): `main.go`
- [Create Handler](https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/create/restintentcreate.go): `controller/rest/intent/create/restintentcreate.go`
- [Confirm Handler](https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/confirm/restintentconfirm.go): `controller/rest/intent/confirm/restintentconfirm.go`
- [Capture Handler](https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/capture/restintentcapture.go): `controller/rest/intent/capture/restintentcapture.go`
- [Cancel Handler](https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/cancel/restintentcancel.go): `controller/rest/intent/cancel/restintentcancel.go`
- [Get Handler](https://github.com/lelledev/upaygo/blob/main/controller/rest/intent/get/restintentget.go): `controller/rest/intent/get/restintentget.go`

### Intent Operations

- [Create Intent](https://github.com/lelledev/upaygo/blob/main/payment/intent/create/intentcreate.go): `payment/intent/create/intentcreate.go`
- [Confirm Intent](https://github.com/lelledev/upaygo/blob/main/payment/intent/confirm/intentconfirm.go): `payment/intent/confirm/intentconfirm.go`
- [Capture Intent](https://github.com/lelledev/upaygo/blob/main/payment/intent/capture/intentcapture.go): `payment/intent/capture/intentcapture.go`
- [Cancel Intent](https://github.com/lelledev/upaygo/blob/main/payment/intent/cancel/intentcancel.go): `payment/intent/cancel/intentcancel.go`
- [Retrieve Intent](https://github.com/lelledev/upaygo/blob/main/payment/intent/get/intentget.go): `payment/intent/get/intentget.go`

### Payment Domain

- [Intent Model](https://github.com/lelledev/upaygo/blob/main/payment/intent/intent.go): `payment/intent/intent.go`
- [Stripe Conversion](https://github.com/lelledev/upaygo/blob/main/payment/intent/stripeconv.go): `payment/intent/stripeconv.go`
- [Amount](https://github.com/lelledev/upaygo/blob/main/amount/amount.go): `amount/amount.go`
- [Currency](https://github.com/lelledev/upaygo/blob/main/currency/currency.go): `currency/currency.go`
- [Customer](https://github.com/lelledev/upaygo/blob/main/customer/customer.go): `customer/customer.go`
- [Stripe Customer](https://github.com/lelledev/upaygo/blob/main/customer/customerstripe.go): `customer/customerstripe.go`
- [Payment Source](https://github.com/lelledev/upaygo/blob/main/payment/source/paymentsource.go): `payment/source/paymentsource.go`

### Gateway Configuration

- [App Configuration](https://github.com/lelledev/upaygo/blob/main/config/config.go): `config/config.go`
- [Stripe Clients](https://github.com/lelledev/upaygo/blob/main/config/stripe_client.go): `config/stripe_client.go`

### Other components

- **Payment Client**
- **Stripe API**

## Connections

- Payment Client → HTTP Server: sends requests (evidence: `main.go`)
- HTTP Server → Create Handler: routes requests (evidence: `main.go`)
- HTTP Server → Confirm Handler: routes requests (evidence: `main.go`)
- HTTP Server → Capture Handler: routes requests (evidence: `main.go`)
- HTTP Server → Cancel Handler: routes requests (evidence: `main.go`)
- HTTP Server → Get Handler: routes requests (evidence: `main.go`)
- Create Handler → Create Intent: creates intent (evidence: `controller/rest/intent/create/restintentcreate.go`)
- Confirm Handler → Confirm Intent: confirms intent (evidence: `controller/rest/intent/confirm/restintentconfirm.go`)
- Capture Handler → Capture Intent: captures intent (evidence: `controller/rest/intent/capture/restintentcapture.go`)
- Cancel Handler → Cancel Intent: cancels intent (evidence: `controller/rest/intent/cancel/restintentcancel.go`)
- Get Handler → Retrieve Intent: retrieves intent (evidence: `controller/rest/intent/get/restintentget.go`)
- Create Intent → Stripe Clients: selects client (evidence: `payment/intent/create/intentcreate.go`)
- Confirm Intent → Stripe Clients: selects client (evidence: `payment/intent/confirm/intentconfirm.go`)
- Capture Intent → Stripe Clients: selects client (evidence: `payment/intent/capture/intentcapture.go`)
- Cancel Intent → Stripe Clients: selects client (evidence: `payment/intent/cancel/intentcancel.go`)
- Retrieve Intent → Stripe Clients: selects client (evidence: `payment/intent/get/intentget.go`)
- Stripe Customer → Stripe Clients: selects client (evidence: `customer/customerstripe.go`)
- Create Intent → Stripe API: creates payment intent (evidence: `payment/intent/create/intentcreate.go`)
- Confirm Intent → Stripe API: confirms payment intent (evidence: `payment/intent/confirm/intentconfirm.go`)
- Capture Intent → Stripe API: captures payment intent (evidence: `payment/intent/capture/intentcapture.go`)
- Cancel Intent → Stripe API: manages payment intent
- Retrieve Intent → Stripe API: retrieves payment intent
- Stripe Customer → Stripe API: creates customer (evidence: `customer/customerstripe.go`)
- Create Intent → Amount: uses amount (evidence: `payment/intent/create/intentcreate.go`)
- Create Intent → Customer: uses customer (evidence: `payment/intent/create/intentcreate.go`)
- Create Intent → Payment Source: uses source (evidence: `payment/intent/create/intentcreate.go`)
- Amount → Currency: uses currency (evidence: `amount/amount.go`)
- Create Intent → Intent Model: builds intent (evidence: `payment/intent/create/intentcreate.go`)
- Confirm Intent → Intent Model: builds intent (evidence: `payment/intent/confirm/intentconfirm.go`)
- Capture Intent → Intent Model: builds intent (evidence: `payment/intent/capture/intentcapture.go`)
- Stripe Conversion → Intent Model: constructs model (evidence: `payment/intent/stripeconv.go`)
- Stripe Conversion → Amount: maps amount (evidence: `payment/intent/stripeconv.go`)
- Stripe Conversion → Customer: maps customer (evidence: `payment/intent/stripeconv.go`)
- Stripe Conversion → Payment Source: maps source (evidence: `payment/intent/stripeconv.go`)
- App Configuration → Stripe Clients: provides settings
- Stripe Clients → Stripe API: configures credentials (evidence: `README.md`)
