Python SDK for WechatPay V3
Project description
pywechatpay
介绍
pywechatpay 是微信支付 V3
版接口的库.
安装
从 PyPi 安装:
$ pip install pywechatpay
使用教程
准备
参考微信官方文档准备好密钥, 证书文件和配置( 证书/密钥/签名介绍)
初始化
from pywechatpay import WechatPay
mch_private_key_string = """
-----BEGIN PRIVATE KEY-----
xxx
-----END PRIVATE KEY-----
"""
wechat_public_key_string = """
-----BEGIN PUBLIC KEY-----
xxx
-----END PUBLIC KEY-----
"""
wechatpay = WechatPay(
mchid="xxx",
mch_serial_no="xxx",
mch_private_key_string=mch_private_key_string.strip(),
wechat_public_key_string=wechat_public_key_string.strip(),
notify_url="http://xxx.com",
app_appid="xxx",
offi_appid="xxx",
mini_appid="xxx",
)
接口
- APP支付 pay/transactions/app
order_string = wechatpay.pay_transactions_app(
description="test", out_trade_no="test0001", amount=1,
)
- H5支付 pay/transactions/h5
order_string = wechatpay.pay_transactions_h5(
description="test", out_trade_no="test0001", amount=1,
)
- JSAPI支付 pay/transactions/jsapi
order_string = wechatpay.pay/transactions/jsapi(
description="test", out_trade_no="test0001", amount=1, payer="xxx"
)
- 小程序支付 pay/transactions/jsapi
order_string = wechatpay.pay/transactions/jsapi(
description="test", out_trade_no="test0001", amount=1, payer="xxx", tag="mini"
)
result = wechatpay.pay_transactions_out_trade_no("test0001")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pywechatpay-0.0.2.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for pywechatpay-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 642da91fc407d8d0bd578e81f279bac07773be4521eb5380b1f232a2a65a370e |
|
MD5 | cc247510eacdc69c4f21fc231760ae3e |
|
BLAKE2b-256 | 7d1567f9dc2a173c10711b08861b3ea6bb7e4c5b647b5105ef1c62bb28316400 |