Core Positioning

The Pay Payment Center is the platform’s “unified checkout counter.” The mall sells goods and needs to collect payments, ERP procurement needs to make payments, member top-ups need to collect payments — all these payment and collection scenarios are handled uniformly through the Payment Center, without business modules needing to care whether the underlying payment method is WeChat Pay or Alipay.

In one sentence: Integrate with the Payment Center once, and all business modules can collect and make payments.


Problems Solved

Pain PointHow Payment Center Solves It
Each business separately integrates WeChat/AlipayUnified integration once, all businesses reuse
Payment channel switching requires changing business codeChannel changes are transparent to business
Payment callback handling is scatteredUnified callback → dispatch to each business module
Payment records are nowhere to be foundPayment Center records all transactions, unified reconciliation

User Roles

graph LR subgraph Roles DEV["Developer
Integrate payment APIs
Handle payment callbacks"] ADMIN2["Operations/Finance
View payment records
Process refunds
Reconciliation"] ENDUSER["End User
Initiate payments
View payment results"] end

Architecture Design

graph TB subgraph BusinessLayer["Business Modules (Payment Callers)"] MALL["Mall
Order Payment"] ERP2["ERP
Purchase Payment"] OTHER["Other Modules
Top-up/Transfer"] end subgraph PaymentCenter["Payment Center yudao-module-pay"] API_LAYER["API Layer
PayOrderApi / PayRefundApi"] CHANNEL["Channel Adapter Layer
PayClient Unified Client"] CALLBACK["Callback Handling Layer
Unified Callback → Dispatch to Business"] end subgraph ChannelLayer["Payment Channels"] WXPAY["WeChat Pay
Official Account/Mini Program/QR Code"] ALIPAY["Alipay
PC/Wap/Transfer"] MOCK["Mock Payment
For development/debugging"] end BusinessLayer --> API_LAYER API_LAYER --> CHANNEL CHANNEL --> ChannelLayer ChannelLayer --> CALLBACK CALLBACK --> BusinessLayer

Payment Application Design

graph TB subgraph AppIsolation APP1["Payment App: Mall Orders
Callback URL: /mall/order/callback
Order Prefix: MALL-"] APP2["Payment App: ERP Procurement
Callback URL: /erp/purchase/callback
Order Prefix: ERP-"] APP3["Payment App: Member Top-up
Callback URL: /member/recharge/callback
Order Prefix: MBR-"] end

Each business module corresponds to a “payment application” with independent callback URL and order number prefix, ensuring payment callbacks are accurately routed to the correct business processing logic.


Full Payment Flow

sequenceDiagram participant U as User participant BIZ as Business System (Mall) participant PAY as Payment Center participant CH as Payment Channel (WeChat/Alipay) U->>BIZ: Submit order, click pay BIZ->>PAY: Create payment order PayOrderApi PAY->>CH: Initiate payment request CH-->>U: Display payment page U->>CH: Complete payment (scan/password) CH-->>PAY: Async callback: Payment successful PAY->>PAY: Update payment order status PAY->>BIZ: Callback notification: Order paid BIZ->>BIZ: Update order status BIZ-->>U: Display payment success

Supported Payment Methods

ChannelPayment MethodUse Case
WeChat PayOfficial Account PaymentWeChat Official Account H5 store
WeChat PayMini Program PaymentWeChat Mini Program store
WeChat PayTransferCommission withdrawal, refunds
AlipayPC PaymentPC-side store
AlipayWap PaymentMobile H5 store
AlipayTransferCommission withdrawal, refunds
Mock PaymentMockDevelopment/debugging, no real account needed

Dependencies

Mall E-Commerce → Pay Payment Center ← ERP Purchase-Sales-Inventory
              System Management Module (Permissions)

Both Mall and ERP depend on the Payment Center, which depends on the System Management module for permissions and configuration management.

docs