Skip to content

weizai118/pingpp-csharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ping++ CSharp SDK

简介

版本要求

至少要求 .NET 4.6 及以上。

注意

  • namespace 由 pingpp 改为 Pingpp
  • 所有方法名更改,首字母大写
  • 如果您的项目中 .NET Framework版本低于 4.6,请切换至 1.4.5 版本

安装

接入方法

初始化

// 设置 API-KEY
Pingpp.Pingpp.SetApiKey("sk_test_ibbTe5jLGCi5rzfH4OqPW9KC");

设置请求签名密钥

密钥需要你自己生成,公钥请填写到 Ping++ Dashboard

Pingpp.Pingpp.SetPrivateKeyPath(@"你生成的私钥文件的路径");

设置重试

设置重试次数,0 表示不重试,默认为 1

Pingpp.Pingpp.SetMaxNetworkRetries(1);

当服务端返回 502 时,是否根据返回内容(阿里高防返回)来判断是否重试。true 表示只要是 502,全部重试,false 关闭重试功能。默认为 true

Pingpp.Pingpp.SetBadGateWayMatch(true);

支付

发起支付请求

Charge ch = Charge.Create(Dictionary<String, Object> param);

查询指定 charge 对象

Charge ch = Charge.Retrieve(String id);

查询 charge 列表

ChargeList chs = Charge.List(Dictionary<String, Object> listParam);

撤销 charge对象

Charge ch = Charge.Reverse(String chargeId);

退款

发起 refund

Refund re = Refund.Create(String chId, Dictionary<String, Object> param);

查询指定 refund

Refund re = Refund.Retrieve(String chId, String reId);

查询 refund 列表

RefundList res = Refund.List(String chId, Dictionary<String, Object> listParam);

微信红包

发送红包请求

RedEnvelope red = RedEnvelope.Create(Dictionary<String, Object> param);

查询指定 RedEnvelope 对象

RedEnvelope red = RedEnvelope.Retrieve(String id);

查询 RedEnvelope 列表

RedEnvelopeList reds = RedEnvelope.List(Dictionary<String, Object> listParam);

企业付款

发送企业付款请求

Transfer tr = Transfer.Create(Dictionary<String, Object> param);

查询指定 Transfer 对象

Transfer tr = Transfer.Retrieve(String id);

查询 Transfer 列表

TransferList trs = Transfer.List(Dictionary<String, Object> listParam);

身份认证请求

创建身份认证请求

Identification.Identify(new Dictionary<string, object> iParams);

报关接口

请求报关接口

Customs.Create(Dictionary<string, object> cuParams);

查询报关接口

Customs.Retrieve(string Id);

批量退款

创建 Batch refund 对象

BatchRefund.Create(Dictionary<string, object> btParams);

查询 Batch refund 列表

BatchRefund.List(Dictionary<string, object> listParams)

查询 Batch refund 对象

BatchRefund.Retrieve(string Id)

批量付款

创建批量付款

BatchTransfer.Create(Dictionary<string, object> btParams);

获取批量付款

BatchTransfer.Retrieve(string batchTransterId)

获取批量付款列表

BatchTransfer.List(Dictionary<string, object> btParams)

Event

查询指定 Event 对象

Event evt = Event.Retrieve(string id);

批量退款

创建 Batch refund 对象

BatchTransfer.Create(Dictionary<string, object> btParams);

查询 Batch refund 列表

BatchTransfer.List(Dictionary<string, object> listParams)

查询 Batch refund 对象

BatchTransfer.Retrieve(string Id)

商品订单

创建商品订单接口

Order.Create(Dictionary<string, object> orParams);

商品订单取消接口

Order.Cancel(string Id);

商品订单查询接口

Order.Retrieve(string Id);

商品订单列表接口

Order.List(Dictionary<string, object> orParams});

商品订单支付接口

Order.Pay(or.Id, Dictionary<string, object> payParams);

商品订单charge列表接口

Order.ChargeList(or.Id);

商品订单charge查询接口

Order.ChargeRetrieve(or.Id, string chargeId);

商品订单退款接口

OrderRefund.Create(string orderId, Dictionary<string, object> reParams);

商品订单退款查询接口

OrderRefund.Retrieve(string orderId, string refundId)

商品订单退款列表查询接口

OrderRefund.List(string orderId)

余额充值

用户余额充值创建
Recharge.Create(appId, Dictionary<string, object> createParams);

用户余额充值查询

Recharge.Retrieve(appId, string Id)

用户余额充值列表

Recharge.List(appId)

用户余额充值退款

RechargeRefund.Create(appId, string Id, Dictionary<string, object> refundParams)

用户余额充值退款查询

RechargeRefund.Create(appId, string Id, string refundId)

用户余额充值退款列表

RechargeRefund.List(appId, string Id));

用户

创建用户对象
User.Create(string appId, Dictionary<string, object> uParams);

查询用户对象列表

User.List(string appId);

查询用户 user 对象

User.Retrieve(string appId, string userId);

更新用户 user 对象

User.Update(string appId, string userId, Dictionary<string, object>);

启用用户对象

User.Enable(string appId, string userId);

禁用用户对象

User.Disable(string appId, string userId)

查询用户账户交易明细列表

BalanceTransaction.List(string  appId, string userId, Dictionary<string, object>  listParams);

用户账户交易明细

BalanceTransaction.Retrieve(string appId, string uid, string txnId);

余额提现申请

Withdrawal.Request(string appId, string uid, Dictionary<string, object> wdParams);

余额提现列表查询

Withdrawal.List(string appId, string uid, Dictionary<string, object> wdParams);

余额提现对象查询

Withdrawal.Retrieve(string appId, string uid, string wrId);

余额提现取消

Withdrawal.Cancel(string appId, string  uid, string  withDramalsId)

余额提现确认

Withdrawal.Confirm(string  appId, string  uid, string withDramalsId)

优惠券

创建单个优惠券

Coupon.Create(string appId, string uid, Dictionary<string, object> couponParams);

查询优惠券对象

Coupon.Retrieve(string  appId, string uid, string couId)

更新优惠券

Coupon.Update(string appId, string uid, string couId, Dictionary<string, object> { { "metadata", Dictionary<string, string> couponParams)

删除优惠券

Coupon.Delete(string appId, string uid, string couId)

优惠券模板

创建优惠券模板

CouponTemplate.Create(string  appId, Dictionary<string, object>  couTmplParams);

获取优惠券模板列表

CouponTemplate.List(string appId)

获取优惠券模板明细

CouponTemplate.Retrieve(string appId, string couTmplId)

更新优惠券模板信息

CouponTemplate.Update(string appId, string couTmplId,Dictionary<string, object> ctplParams)

删除优惠券模板

CouponTemplate.Delete(string appId, string couTmplId)

批量创建优惠券

Coupon.BatchCreate(string appId, string couTmplId, Dictionary<string, object> couponParams)

查询优惠券模板下的优惠券列表

Coupon.ListInTemplate(string appId, string couId)

批量付款

创建批量付款

BatchTransfer.Create(Dictionary<string, object> btParams);

获取批量付款

BatchTransfer.Retrieve(string batchTransterId)

批量提现确认

创建批量提现确认

BatchWithdrawal.Create(string appId, Dictionary<string, object>  batchwrParams);

查询批量提现确认对象

BatchWithdrawal.Create(string appId, string batchWithdrawalId);

子商户

子商户创建

var param = new Dictionary<string, object> {
    {"display_name", "sub_app_display_name"},
    {"user", "user_006"},
    {"metadata", new Dictionary<string,object>{
        {"key", "value"}
    }},
    {"description", "Your description"},
};
SubApp.Create(appId, param)

子商户查询

SubApp.Retrieve(appId, "app_L0GyTKKqfnnPynD4")

子商户更新

var upParam = new Dictionary<string, object> {
    {"display_name", "sub_app_display_name2"},
    {"metadata", new Dictionary<string,object>{
        {"key", "value2"}
    }},
    {"description", "Your description2"},
};
SubApp.Update(appId, "app_L0GyTKKqfnnPynD4", upParam)

删除子商户

SubApp.Delete(appId, "app_L0GyTKKqfnnPynD4")

查询子商户列表

SubApp.List(appId)

子商户渠道

配置子商户渠道参数

var param = new Dictionary<string, object> {
    {"channel", "bfb"},
    {"banned", false},
    {"banned_msg", null},
    {"description", "The description for bfb"},
    {"params", new Dictionary<string,object>{
        {"bfb_sp", "bfb sp"},
        {"fee_rate", 30},
        {"bfb_key", "Your key"}
    }}

};
SubAppChannel.Create(appId, subAppId, param)

更新子商户渠道参数

var upParam = new Dictionary<string, object> {
    {"banned", false},
    {"banned_msg", null},
    {"description", "The new description for bfb"},
    {"params", new Dictionary<string,object>{
        {"bfb_sp", "1500300006"},
        {"fee_rate", 35},
        {"bfb_key", "w837cG3xQk2KMQ3EZVdByEryJpTN7MzC"}
    }}

};
SubAppChannel.Update(appId, subAppId, "bfb", upParam)

删除子商户渠道参数

SubAppChannel.Delete(appId, subAppId, "bfb")

查询子商户渠道参数

SubAppChannel.Retrieve(appId, subAppId, "bfb")

结算账户

创建结算账户

var paramUnionPay = new Dictionary<string, object> {
    {"channel","unionpay"},
    {"recipient", new Dictionary<string,object>{
        {"account", "6214666666666666"},
        {"name", "张三"},
        {"type", "b2c"},    //转账类型。b2c:企业向个人付款,b2b:企业向企业付款。
        {"open_bank", "招商银行"},
        {"open_bank_code", "0308"}
    }}
};
SettleAccount.Create(appId, "test_user_002", paramUnionPay))

查询结算账户

SettleAccount.Retrieve(appId, "test_user_002", "320217032111554400000901")

删除结算账户

SettleAccount.Delete(appId, "test_user_002", "320217032111554400000901")

查询结算账户列表

SettleAccount.List(appId, "test_user_002")

分润

批量更新分润对象

var updateParam = new Dictionary<string, object> {
    {"ids", new List<string>{
        "170301124238000111",
        "170301124238000211"
    }},
    {"method", "manual"},
    {"description", "Your description"}
};
Royaltie.Update(updateParam)

查询分润对象

Royaltie.Retrieve("421170321093600003")

查询分润对象列表

var listParams = new Dictionary<string, object>{
    {"payer_app", "app_LibTW1n1SOq9Pin1"},
    {"source_app","app_LibTW1n1SOq9Pin1"},
    {"page", 1},
    {"per_page", 1}
};
Royaltie.List(listParams)

分润结算

创建分润结算对象

var createParam = new Dictionary<string, object> {
    {"payer_app", "app_LibTW1n1SOq9Pin1"},
    {"method", "alipay"},
    {"recipient_app", "app_1Gqj58ynP0mHeX1q"},
    {"created", new Dictionary<string,object>{
        {"gt"   , 1488211200},
        {"lte"  , 1488297600}
    }}
};
RoyaltySettlement.Create(createParam)

查询分润结算对象

RoyaltySettlement.Retrieve("431170321101800001")

更新分润结算对象

var updateParam = new Dictionary<string, object> {
    {"status", "canceled"}
};
Console.("**** 更新royalty_settlement 对象 ****");
RoyaltySettlement.Update("431170321101800001", updateParam)

查询分润结算对象列表

var listParam = new Dictionary<string, object> {
    {"payer_app", "app_LibTW1n1SOq9Pin1"}
};
RoyaltySettlement.List(listParam)

分润结算明细

查询分润结算明细

RoyaltyTransaction.Retrieve("441170321101800003")

查询分润结算明细列表

var listParam = new Dictionary<string, object> {
    {"page", 1},
    {"per_page", 10}
};
RoyaltyTransaction.List(listParam)

分润模板

分润模板创建

RoyaltyTemplate.Create(Dictionary<string, object> createParam)

分润模板查询

RoyaltyTemplate.Retrieve(string Id)

分润模板更新

RoyaltyTemplate.Update("451170814105500001", Dictionary<string, object> updateParam)

分润模板删除

RoyaltyTemplate.Delete(string Id);

分润模板列表

RoyaltyTemplate.List();

用户余额转账

用户余额转账创建

BalanceTransfer.Create(appId, Dictionary<string, object> createParams);

用户余额转账查询

BalanceTransfer.Retrieve(appId, string balanceTransferId);

用户余额转账列表

BalanceTransfer.List(appId);

用户余额赠送

用户余额赠送创建

BalanceBonus.Create(appId, Dictionary<string, object> createParams));

用户余额赠送查询

BalanceBonus.Retrieve(appId, string balanceBonusId)

用户余额赠送列表

BalanceBonus.List(appId);

用户余额结算列表

BalanceSettlement.List(appId)

用户余额结算查询

BalanceSettlement.Retrieve(appId, string balaneSettlementId)

card_bin查询

CardInfo.Query(List<string> params)

详细信息请参考 API 文档

创建签约

Agreement.Create( Dictionary<string, object> createParams)

查询签约状态

Agreement.Retrieve(string Id)

解除签约

Agreement.Cancel(string Id)

查询签约列表

Agreement.List( Dictionary<string, object> listParams)

微信公众号获取openid

WxPubUtils.GetOpenId(string appId, string appSecret, string code)

微信小程序获取openid

WxPubUtils.GetWxLiteOpenId(string appId, string appSecret, string code)

About

Pingpp SDK in CSharp

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%