pingpp 文件夹下是 Python SDK 文件,
example 文件夹里面是简单的接入示例,该示例仅供参考。
pip install pingpp
或使用 setup.py 手动安装
python setup.py install
pingpp.api_key = 'YOUR_KEY'密钥需要你自己生成,公钥请填写到 Ping++ Dashboard
设置你的私钥路径
pingpp.private_key_path = '/path/to/your_rsa_private_key.pem'ch = pingpp.Charge.create(
order_no='123456789',
channel='alipay',
amount=1,
subject='test-subject',
body='test-body',
currency='cny',
app=dict(id='APP_ID'),
client_ip='127.0.0.1'
)pingpp.Charge.retrieve('CHARGE_ID')pingpp.Charge.all()ch = pingpp.Charge.retrieve('CHARGE_ID')
re = ch.refunds.create(
amount=1,
description='Refund Description'
)ch = pingpp.Charge.retrieve('CHARGE_ID')
re = ch.refunds.retrieve('REFUND_ID')ch = pingpp.Charge.retrieve('CHARGE_ID')
res = ch.refunds.all(limit=3)pingpp.RedEnvelope.create(
order_no='123456789',
channel='wx_pub',
amount=100,
subject='Your Subject',
body='Your Body',
currency='cny',
app=dict(id='APP_ID'),
extra=dict(send_name='Send Name'),
recipient='User Openid',
description='Your Description'
)pingpp.RedEnvelope.retrieve('RED_ID')pingpp.RedEnvelope.all()pingpp.Event.retrieve('EVENT_ID')pingpp.Event.all()tr = pingpp.Transfer.create(
order_no='1234567890',
channel='wx_pub',
amount=100,
currency='cny',
app=dict(id='APP_ID'),
type='b2c',
recipient='User Openid',
extra=dict(user_name='User Name', force_check=False),
description='Your Description'
)pingpp.Transfer.retrieve('TRANSFER_ID')pingpp.Transfer.all()详细信息请参考 API 文档。