Mobile Development 14 min read

Building a C++ Cross‑Platform Framework for WeChat Pay: Architecture, Routing, and Quality Assurance

This article details how a C++‑based cross‑platform framework was designed for WeChat Pay to unify iOS and Android implementations, improve scalability, quality assurance, and developer productivity through use‑case abstraction, a routing mechanism, and refined network and data handling.

IT Architects Alliance
IT Architects Alliance
IT Architects Alliance
Building a C++ Cross‑Platform Framework for WeChat Pay: Architecture, Routing, and Quality Assurance

WeChat Pay faces significant challenges across different operating systems and applications, primarily due to fragmented platform implementations that cause bugs, poor scalability, inconsistent quality assurance, and divergent user experiences.

To address these core issues, a C++‑based cross‑platform framework was built, consolidating the payment flow for iOS (from version 7.0.4) and Android (from version 7.0.7). The new architecture reduced the core payment code by nearly 45% (3512 lines vs. 6328 lines native) and accelerated feature delivery, completing version 7.0.4 requirements in just three person‑days.

Key architectural steps:

Abstract business processes into UseCase components, separating flow logic from UI controllers.

Introduce a routing mechanism that encapsulates payment‑related actions (e.g., opening a WebView, launching a mini‑program, showing a dialog) and passes a unified data model.

Refactor network requests: each CGI becomes an independent command object with a clear lifecycle tied to its initiating UseCase , eliminating one‑to‑many communication bugs and lifecycle mismatches.

Standardize data transmission by removing shared mutable models, using immutable value types, and enforcing unidirectional data flow with dependency injection and delegate patterns for necessary callbacks.

These changes yielded measurable improvements: crash rates remained stable after launch, performance gains were evident from the reduced codebase, and special‑process handling (WebView, mini‑program, dialogs) saw an 83% code reduction.

The evolved architecture now consists of three layers: (1) abstracted business flow, (2) routing‑driven navigation, and (3) disciplined network request management, all built on a clean C++ core that can be shared across iOS and Android.

In summary, the article argues that software architecture’s purpose is to manage complexity; by iteratively refining the WeChat Pay client architecture, the team achieved higher reliability, maintainability, and productivity, laying a foundation for future feature development and automated data reporting.

Mobile DevelopmentSoftware ArchitectureCross-Platformquality assuranceCRoutingWeChat Pay
IT Architects Alliance
Written by

IT Architects Alliance

Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.

0 followers
Reader feedback

How this landed with the community

login 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.