wechatpayv3
微信支付 Python SDK(python sdk for wechatpay)
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 wechatpayv3uv
uv add wechatpayv3poetry
poetry add wechatpayv3Installing 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, 微信支付
Tags
More Financial packages
statsmodels provides statistical models,…
permissive · top 1,000 on PyPI
yfinanceFetches financial and market data from Yahoo…
permissive · top 1,000 on PyPI
bokehBokeh is an interactive visualization library…
permissive · top 5,000 on PyPI
python-stdnumParses, validates, and reformats standard…
copyleft · top 5,000 on PyPI
panelPanel is a Python framework for building…
permissive · top 5,000 on PyPI
databentoOfficial Python client for accessing live and…
permissive · top 5,000 on PyPI
wechatpyWeChat SDK providing Python bindings for…
permissive · top 15,000 on PyPI
braintreeProvides Python bindings to the Braintree…
permissive · top 5,000 on PyPI
recurlyOfficial Python client library for Recurly's V3…
unclear · top 15,000 on PyPI
yelpapiyelpapi wraps the Yelp Fusion API, letting you…
permissive · top 15,000 on PyPI
paytmchecksumGenerates and verifies checksums for Paytm…
permissive · top 15,000 on PyPI
razorpayPython client library for the Razorpay payment…
permissive · top 5,000 on PyPI
paypalrestsdkA REST client library for integrating PayPal…
unclear · top 5,000 on PyPI
Flask-AWSCognitoIntegrates AWS Cognito user authentication into…
permissive · top 15,000 on PyPI
gmsslPure-Python implementation of SM2, SM3, and SM4…
permissive · top 15,000 on PyPI
binance-connectorConnects Python applications to Binance's…
permissive · top 15,000 on PyPI