# txnixon/wc-paperid architecture

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

- Interactive diagram: https://gitdiagram.com/txnixon/wc-paperid
- Repository: https://github.com/txnixon/wc-paperid

## Overview

This WordPress plugin registers a WooCommerce gateway that creates Paper.id payment requests for customer orders, redirects customers to checkout, and processes Paper.id callbacks to update order status. Merchants configure credentials, environment, callback, and notification options in WooCommerce; the API client builds invoices and requests enabled email/WhatsApp notifications. The README also documents GitHub auto-updates, debugging logs, and HPOS compatibility. The excerpts show the gateway/API/callback and updater behavior; other details are based on README claims and are not expanded beyond supported paths.

Main entry points: [`includes/class-paper-id-api.php`](https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-api.php) (Payment API Client), [`includes/class-wc-gateway-paper-id.php`](https://github.com/txnixon/wc-paperid/blob/main/includes/class-wc-gateway-paper-id.php) (Gateway Settings), [`includes/class-paper-id-helper.php`](https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-helper.php) (Order and Status Helpers), [`paper-id-woocommerce.php`](https://github.com/txnixon/wc-paperid/blob/main/paper-id-woocommerce.php) (Plugin Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["WooCommerce Gateway"]
  node_plugin["Plugin Bootstrap"]
  node_gateway_class["Gateway Settings"]
  node_callback["Webhook Handler"]
  node_helper["Order and Status Helpers"]
end

subgraph group_payment["Paper.id Payments"]
  node_api["Payment API Client"]
  node_paper{{"Paper.id API"}}
  node_rails{{"Payment Methods"}}
  node_notifications{{"Invoice Notifications"}}
end

subgraph group_operations["Operations"]
  node_logger[("WooCommerce Logs")]
  node_updater["GitHub Auto-Updater"]
  node_github{{"GitHub Releases"}}
  node_wp_updates["WordPress Updates"]
  node_hpos["HPOS Compatibility"]
end

node_merchant(("Merchant Admin"))
node_customer(("Customer Checkout"))
node_woocommerce["WooCommerce Orders"]

node_merchant -->|"configures"| node_gateway_class
node_plugin -->|"registers"| node_gateway_class
node_plugin -->|"initializes"| node_updater
node_plugin -->|"declares support"| node_hpos
node_customer -->|"places order"| node_woocommerce
node_woocommerce -->|"invokes payment"| node_gateway_class
node_gateway_class -->|"creates request"| node_api
node_api -->|"formats order"| node_helper
node_api -->|"requests invoice"| node_paper
node_paper -->|"returns link"| node_api
node_api -->|"logs activity"| node_helper
node_api -->|"requests notices"| node_notifications
node_paper -->|"offers methods"| node_rails
node_api -->|"returns payment link"| node_gateway_class
node_gateway_class -->|"redirects to payment"| node_customer
node_paper -->|"sends callback"| node_callback
node_callback -->|"maps status"| node_helper
node_callback -->|"updates order"| node_woocommerce
node_callback -->|"logs callback"| node_helper
node_helper -->|"writes logs"| node_logger
node_updater -->|"checks releases"| node_github
node_updater -->|"provides updates"| node_wp_updates

click node_plugin "https://github.com/txnixon/wc-paperid/blob/main/paper-id-woocommerce.php"
click node_gateway_class "https://github.com/txnixon/wc-paperid/blob/main/includes/class-wc-gateway-paper-id.php"
click node_callback "https://github.com/txnixon/wc-paperid/blob/main/includes/class-wc-gateway-paper-id.php"
click node_helper "https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-helper.php"
click node_api "https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-api.php"
click node_updater "https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-updater.php"
click node_hpos "https://github.com/txnixon/wc-paperid/blob/main/paper-id-woocommerce.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_plugin,node_gateway_class,node_callback,node_helper toneBlue
class node_api,node_paper,node_rails,node_notifications toneAmber
class node_logger,node_updater,node_github,node_wp_updates,node_hpos toneMint
class node_merchant,node_customer,node_woocommerce toneIndigo
```

## Components

### WooCommerce Gateway

- [Plugin Bootstrap](https://github.com/txnixon/wc-paperid/blob/main/paper-id-woocommerce.php): `paper-id-woocommerce.php`
- [Gateway Settings](https://github.com/txnixon/wc-paperid/blob/main/includes/class-wc-gateway-paper-id.php): `includes/class-wc-gateway-paper-id.php`
- [Webhook Handler](https://github.com/txnixon/wc-paperid/blob/main/includes/class-wc-gateway-paper-id.php): `includes/class-wc-gateway-paper-id.php`
- [Order and Status Helpers](https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-helper.php): `includes/class-paper-id-helper.php`

### Paper.id Payments

- [Payment API Client](https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-api.php): `includes/class-paper-id-api.php`
- **Paper.id API**
- **Payment Methods**
- **Invoice Notifications**

### Operations

- **WooCommerce Logs**
- [GitHub Auto-Updater](https://github.com/txnixon/wc-paperid/blob/main/includes/class-paper-id-updater.php): `includes/class-paper-id-updater.php`
- **GitHub Releases**
- **WordPress Updates**
- [HPOS Compatibility](https://github.com/txnixon/wc-paperid/blob/main/paper-id-woocommerce.php): `paper-id-woocommerce.php`

### Other components

- **Merchant Admin**
- **Customer Checkout**
- **WooCommerce Orders**

## Connections

- Merchant Admin → Gateway Settings: configures
- Plugin Bootstrap → Gateway Settings: registers
- Plugin Bootstrap → GitHub Auto-Updater: initializes
- Plugin Bootstrap → HPOS Compatibility: declares support
- Customer Checkout → WooCommerce Orders: places order
- WooCommerce Orders → Gateway Settings: invokes payment
- Gateway Settings → Payment API Client: creates request
- Payment API Client → Order and Status Helpers: formats order
- Payment API Client → Paper.id API: requests invoice
- Paper.id API → Payment API Client: returns link
- Payment API Client → Order and Status Helpers: logs activity
- Payment API Client → Invoice Notifications: requests notices
- Paper.id API → Payment Methods: offers methods
- Payment API Client → Gateway Settings: returns payment link
- Gateway Settings → Customer Checkout: redirects to payment
- Paper.id API → Webhook Handler: sends callback
- Webhook Handler → Order and Status Helpers: maps status
- Webhook Handler → WooCommerce Orders: updates order
- Webhook Handler → Order and Status Helpers: logs callback
- Order and Status Helpers → WooCommerce Logs: writes logs
- GitHub Auto-Updater → GitHub Releases: checks releases
- GitHub Auto-Updater → WordPress Updates: provides updates
