skillfed

wechatpayv3

微信支付 Python SDK(python sdk for wechatpay)

wechatpayv3 v2.0.3 1.4M downloads/30d#3,965 on PyPI1,330
Permissive license MIT Active released

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 on this page — 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

wechatpayv3 on PyPI

pip

pip install wechatpayv3

uv

uv add wechatpayv3

poetry

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 not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — requests, cryptography
Maintenance actively maintained — 27 days since the last release
Last repo commit
First released
Downloads 1,390,227/month — #3,965 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: wechatpayv3-2.0.3-py3-none-any.whl

Keywords: python, sdk, wechatpay, api, v3, 微信支付

Development Status :: 5 - Production/StableProgramming Language :: Python :: 3Topic :: Office/Business :: Financial

Tags

wechat pay api integrationchinese payment gateway sdkweixin pay v3 pythonpayment callback verificationmerchant certificate management
payment-processingchinese-fintech

More Financial packages