Skip to content

michealzh/pingpp-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pingpp Python SDK


简介

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()

查询 event

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()

Batch Refunds 批量退款

创建 Batch refund 对象

pingpp.BatchRefund.create"app": app_id,
    "batch_no": "batchrefund20160801001",
    "description": "Batch refund description.",
    "charges": [
        "ch_L8qn10mLmr1GS8e5OODmHaL4",
        "ch_fdOmHaLmLmr1GOD4qn1dS8e5"
    ]
)

查询 Batch refund 对象

pingpp.BatchRefund.retrieve('BATCH_REFUND_ID')

查询 Batch refund 对象列表

pingpp.BatchRefund.list()

Batch Transfers 批量企业付款

创建批量付款

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()

更新批量付款对象 (仅unionpay渠道支持)

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 文档

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 100.0%