# yangeni/gopay_plus_automatic architecture

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

- Interactive diagram: https://gitdiagram.com/yangeni/gopay_plus_automatic
- Repository: https://github.com/yangeni/gopay_plus_automatic

## Overview

This repository automates ChatGPT Plus subscription through GoPay. A client submits a session token to the HTTP orchestrator, which starts a payment flow over gRPC, obtains an OTP through the configured mode, completes payment, and returns the subscription result. The payment service owns pending-flow state and delegates payment work to the GoPay implementation. README documents Stripe/Midtrans/GoPay payment stages and manual, SMS API, and WhatsApp OTP options; sampled code confirms the service calls. Some detailed payment and OTP-mode wiring is documented but not fully excerpted.

Main entry points: [`orchestrator.py`](https://github.com/yangeni/gopay_plus_automatic/blob/main/orchestrator.py) (HTTP orchestrator), [`plus_gopay_links/gopay.py`](https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/gopay.py) (GoPay payment flow), [`plus_gopay_links/payment_server.py`](https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/payment_server.py) (Payment gRPC service), [`to_whatsapp/index.js`](https://github.com/yangeni/gopay_plus_automatic/blob/main/to_whatsapp/index.js) (WhatsApp OTP relay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_subscription["Subscription API"]
  node_orchestrator["HTTP orchestrator<br/>[orchestrator.py]"]
  node_subscription_result["Subscription result"]
end

subgraph group_payment["Payment processing"]
  node_payment_service["Payment gRPC service<br/>[payment_server.py]"]
  node_flow_store[("Pending flow store<br/>[payment_server.py]")]
  node_gopay_flow["GoPay payment flow<br/>[gopay.py]"]
end

subgraph group_otp["OTP delivery"]
  node_otp_input["OTP intake<br/>[orchestrator.py]"]
  node_sms_provider["SMS API"]
  node_manual_source["Manual or ADB OTP<br/>[otp_forwarder.py]"]
  node_whatsapp_relay["WhatsApp OTP relay<br/>[index.js]"]
  node_whatsapp_manager["Relay process manager<br/>[wa_relay.py]"]
end

subgraph group_integrations["External integrations"]
  node_chatgpt["ChatGPT"]
  node_stripe["Stripe"]
  node_midtrans["Midtrans"]
  node_gopay["GoPay"]
end

node_client(("API client"))

node_client -->|"submits request"| node_orchestrator
node_orchestrator -->|"starts payment"| node_payment_service
node_payment_service -->|"stores flow"| node_flow_store
node_payment_service -->|"delegates payment"| node_gopay_flow
node_orchestrator -->|"accepts OTP"| node_otp_input
node_manual_source -->|"pushes OTP"| node_otp_input
node_sms_provider -.->|"provides code"| node_otp_input
node_orchestrator -->|"requests OTP"| node_whatsapp_relay
node_whatsapp_manager -->|"starts sidecar"| node_whatsapp_relay
node_gopay_flow -->|"creates checkout"| node_chatgpt
node_gopay_flow -->|"creates payment method"| node_stripe
node_gopay_flow -->|"requests payment setup"| node_midtrans
node_gopay_flow -->|"links and charges"| node_gopay
node_orchestrator -->|"completes payment"| node_payment_service
node_orchestrator -->|"returns outcome"| node_subscription_result

click node_orchestrator "https://github.com/yangeni/gopay_plus_automatic/blob/main/orchestrator.py"
click node_payment_service "https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/payment_server.py"
click node_flow_store "https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/payment_server.py"
click node_gopay_flow "https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/gopay.py"
click node_otp_input "https://github.com/yangeni/gopay_plus_automatic/blob/main/orchestrator.py"
click node_manual_source "https://github.com/yangeni/gopay_plus_automatic/blob/main/otp_forwarder.py"
click node_whatsapp_relay "https://github.com/yangeni/gopay_plus_automatic/blob/main/to_whatsapp/index.js"
click node_whatsapp_manager "https://github.com/yangeni/gopay_plus_automatic/blob/main/to_whatsapp/wa_relay.py"

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_orchestrator,node_subscription_result,node_client toneBlue
class node_payment_service,node_flow_store,node_gopay_flow toneAmber
class node_otp_input,node_sms_provider,node_manual_source,node_whatsapp_relay,node_whatsapp_manager toneMint
class node_chatgpt,node_stripe,node_midtrans,node_gopay toneRose
```

## Components

### Subscription API

- [HTTP orchestrator](https://github.com/yangeni/gopay_plus_automatic/blob/main/orchestrator.py): `orchestrator.py`
- **Subscription result**

### Payment processing

- [Payment gRPC service](https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/payment_server.py): `plus_gopay_links/payment_server.py`
- [Pending flow store](https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/payment_server.py): `plus_gopay_links/payment_server.py`
- [GoPay payment flow](https://github.com/yangeni/gopay_plus_automatic/blob/main/plus_gopay_links/gopay.py): `plus_gopay_links/gopay.py`

### OTP delivery

- [OTP intake](https://github.com/yangeni/gopay_plus_automatic/blob/main/orchestrator.py): `orchestrator.py`
- **SMS API**
- [Manual or ADB OTP](https://github.com/yangeni/gopay_plus_automatic/blob/main/otp_forwarder.py): `otp_forwarder.py`
- [WhatsApp OTP relay](https://github.com/yangeni/gopay_plus_automatic/blob/main/to_whatsapp/index.js): `to_whatsapp/index.js`
- [Relay process manager](https://github.com/yangeni/gopay_plus_automatic/blob/main/to_whatsapp/wa_relay.py): `to_whatsapp/wa_relay.py`

### External integrations

- **ChatGPT**
- **Stripe**
- **Midtrans**
- **GoPay**

### Other components

- **API client**

## Connections

- API client → HTTP orchestrator: submits request (evidence: `README.md`)
- HTTP orchestrator → Payment gRPC service: starts payment (evidence: `orchestrator.py`)
- Payment gRPC service → Pending flow store: stores flow (evidence: `plus_gopay_links/payment_server.py`)
- Payment gRPC service → GoPay payment flow: delegates payment (evidence: `plus_gopay_links/payment_server.py`)
- HTTP orchestrator → OTP intake: accepts OTP (evidence: `orchestrator.py`)
- Manual or ADB OTP → OTP intake: pushes OTP (evidence: `otp_forwarder.py`)
- SMS API → OTP intake: provides code (evidence: `README.md`)
- HTTP orchestrator → WhatsApp OTP relay: requests OTP (evidence: `README.md`)
- Relay process manager → WhatsApp OTP relay: starts sidecar (evidence: `to_whatsapp/wa_relay.py`)
- GoPay payment flow → ChatGPT: creates checkout (evidence: `README.md`)
- GoPay payment flow → Stripe: creates payment method (evidence: `plus_gopay_links/gopay.py`)
- GoPay payment flow → Midtrans: requests payment setup (evidence: `README.md`)
- GoPay payment flow → GoPay: links and charges (evidence: `plus_gopay_links/gopay.py`)
- HTTP orchestrator → Payment gRPC service: completes payment (evidence: `README.md`)
- HTTP orchestrator → Subscription result: returns outcome (evidence: `README.md`)
