--- id: wechatpayv3 version: "2.0.3" license: MIT license_treatment: permissive maintenance: active --- # wechatpayv3 — 微信支付 Python SDK(python sdk for wechatpay) License: permissive · Maintenance: active · Downloads: 1.4M/mo ## What it is and what it does This is a Python SDK for WeChat Pay's API v3, designed to simplify payment processing integration for both direct merchant mode and service provider mode. It wraps the WeChat payment API with automatic handling of platform certificates, encryption of sensitive data, and callback signature verification—removing the need for developers to manually manage cryptographic operations or certificate lifecycle. The package handles the full payment flow: initializing a merchant account with credentials, processing payment orders (supporting Native, H5, mini-program, JSAPI, and APP payment types), and validating incoming payment notifications. It supports both synchronous and asynchronous request patterns, making it compatible with frameworks like Flask and FastAPI. Dependencies are minimal (requests for HTTP calls, cryptography for encryption), and the SDK manages certificate caching locally to reduce repeated downloads. Use it for: - Process WeChat QR code (Native) payments in a web backend, converting payment orders to QR codes for mobile scanning. - Validate and decrypt incoming payment notification callbacks from WeChat's servers to confirm transaction completion. - Integrate WeChat payment into a mini-program or H5 app using JSAPI or APP payment types with automatic request signing. - Manage merchant API certificates and platform public keys without manual certificate renewal or rotation logic. - Build async payment endpoints in FastAPI or similar frameworks using the package's async/await support. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. SDK for integrating WeChat Pay API v3 into Python applications, handling payment processing, certificate management, encryption, and callback verification. Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with minimal friction. It is purpose-built for WeChat Pay integration and handles the cryptographic and certificate complexity that would otherwise require significant custom implementation. Suitable for production use if your application needs to accept WeChat payments. ## Install pip install wechatpayv3 uv add wechatpayv3 poetry add wechatpayv3 ## Installing wechatpayv3 Before you install: Low friction installation with only 2 runtime dependencies (requests and cryptography). Package is actively maintained with recent commits and 1330 repository stars, indicating stable ongoing development. License in practice: MIT license permits commercial and private use with minimal restrictions, making it suitable for production payment integrations. Quickstart: from wechatpayv3 import WeChatPay, WeChatPayType wxpay = WeChatPay( wechatpay_type=WeChatPayType.NATIVE, mchid='merchant_id', private_key=PRIVATE_KEY, cert_serial_no=CERT_SERIAL_NO, apiv3_key=APIV3_KEY, appid=APPID, notify_url=NOTIFY_URL, cert_dir='./cert' ) code, message = wxpay.pay( description='payment description', out_trade_no='order_id', amount={'total': 100}, pay_type=WeChatPayType.NATIVE ) Requires merchant credentials from WeChat Pay backend: private key file, certificate serial number, API v3 key, and app ID. These must be obtained and configured before initialization. Verify before relying: - Whether async support requires additional setup beyond the optional [async] extra - Specific Python version compatibility (requires_python not specified in metadata) - Whether platform certificate auto-update works offline or requires network access ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags wechat pay api integration, chinese payment gateway sdk, weixin pay v3 python, payment callback verification, merchant certificate management, payment-processing, chinese-fintech [View on SkillFed](https://skillfed.io/packages/wechatpayv3) · [View on PyPI](https://pypi.org/project/wechatpayv3/)