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')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()pingpp.BatchRefund.create(
"app": app_id,
"batch_no": "batchrefund20160801001",
"description": "Batch refund description.",
"charges": [
"ch_L8qn10mLmr1GS8e5OODmHaL4",
"ch_fdOmHaLmLmr1GOD4qn1dS8e5"
]
)pingpp.BatchRefund.retrieve('BATCH_REFUND_ID')pingpp.BatchRefund.list()req_params = {
"app": app_id,
"batch_no": "batchrefund20160801001",
"description": "Batch refund description.",
"charges": [
"ch_L8qn10mLmr1GS8e5OODmHaL4",
"ch_fdOmHaLmLmr1GOD4qn1dS8e5"
]
}
pingpp.BatchTransfer.create(**req_params)pingpp.BatchTransfer.retrieve('BATCH_TRANSFER_ID')pingpp.BatchTransfer.list()pingpp.BatchTransfer.cancel('BATCH_TRANSFER_ID')params = {
"app": "APP_ID",
"data": {
"id_name": "张三",
"id_number": "320291198811110000",
"card_number": "6201111122223333"
},
"type": "bank_card"
}
pingpp.Identification.create(**params)pingpp.Customs.create(
app='App ID',
charge='Charge ID',
channel='alipay',
amount=100, # 报关金额, 人民币单位:分
customs_code='GUANGZHOU',
trade_no='15112496832609'
)pingpp.Customs.retrieve("CUSTOMS_ID")详细信息请参考 API 文档。