Design Patterns and Essential Elements of External Payment System Interfaces

The article reviews common payment channels such as Alipay, WeChat Pay, and point‑deduction models, analyzes their interface designs, security checks, and optional steps, and summarizes the mandatory API and security components required for robust payment system integration.

Architecture Digest
Architecture Digest
Architecture Digest
Design Patterns and Essential Elements of External Payment System Interfaces

As a website with user transaction capabilities, enriching its payment channels is crucial for user acquisition and daily active user growth. The author summarizes design patterns of external payment system interfaces based on dozens of integrations they have encountered.

1. Alipay

Alipay is the largest domestic payment platform, and most websites integrate with it; many smaller channels also follow its interface design. The payment flow is illustrated in the diagram below.

The flow includes many hidden security details such as data encryption and signature verification, IP whitelist for asynchronous callbacks, and order verification against the site’s own records. Optional steps like synchronous callbacks can be omitted to improve user experience, relying solely on asynchronous callbacks for order confirmation.

2. WeChat Pay

The transaction volume of WeChat Pay is also considerable, and its flow is shown in the following diagram.

Compared with Alipay, the order creation step differs: WeChat Pay’s order request is made by the server, while Alipay’s is initiated from the front end. Server‑side order creation hides order details from the client, reducing the risk of tampering and improving security.

3. Deep‑Cooperation Point Deduction Model

Some sites or games cooperate with third‑party platforms to allow users to deduct points for goods or items. The third party provides a trusted API that lets the site deduct a user’s points after the user binds accounts. The flow, shown below, is relatively simple and usually involves only backend API calls without a front‑end checkout page.

This model requires proper interface encryption, signature verification, and agreed settlement rules, and benefits from the third party’s ability to query orders by the site’s order number for reconciliation.

4. Summary: Essential Elements of Payment System Interfaces

4.1 Interface Components

Order creation interface

Synchronous callback notification (must include both order IDs, amount, user info, status)

Asynchronous callback notification (same content as synchronous)

Transaction order query interface (supports querying by either party’s order ID to verify order validity and handle cases where callbacks are missed)

4.2 Security Components

Data encryption: HTTPS, AES, asymmetric encryption (public/private keys)

Signature rules: apply a hash (e.g., SHA‑256) to the whole payload and transmit the signature to prevent tampering

IP whitelist: restrict server‑to‑server calls to trusted IPs

Order information verification: actively query the payment channel to ensure order accuracy

Source: PHP Architecture public account

Copyright statement: Content originates from the web, copyright belongs to the original author. If any infringement is found, please notify us for removal.

-END-

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendSecurityapi-designWeChat PayPayment IntegrationAlipay
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.