你可以请求一个新的 transfer 对象发起一次企业付款。如果支付失败,请检查错误信息,一般是由于账户余额不足引起的。
使用测试模式的 API Key,则不会发生真实交易。测试模式需要调用 查询 接口更新 test 模式下transfer对象的状态,Ping++ 才会发送 Webhooks 通知。
注:1、渠道为 wx_lite、alipay、unionpay、allinpay 时,强制要求 签名 (Pingplusplus-Signature),需在管理平台上 配置商户公钥 ;2、微信企业付款区分"企业付款到零钱"和"企业付款到银行卡",使用此功能时请确保在微信处开通相应产品。此外,使用微信服务商模式商户暂不支持企业付款。
| 请求参数 | 描述 | 
|---|---|
| app[id] expandable required string | 转账使用的 app对象的id,expandable可展开,查看如何获取App ID。 | 
| channel required string | 付款使用的第三方支付渠道名称。目前支持 wx(微信 App)、wx_pub(微信 JSAPI)、wx_lite(微信小程序)、alipay(支付宝)、unionpay(银联电子代付)、allinpay(通联代付)和balance(余额)。 | 
| order_no required string | 付款使用的商户内部订单号。 wx/wx_pub/wx_lite规定为 1 ~ 32 位不能重复的数字字母组合;alipay为 1 ~ 64 位不能重复的数字字母组合;unionpay为 1 ~ 16 位的纯数字;allinpay为 20 ~ 40 位不能重复的数字字母组合,必须以签约的通联的商户号开头(建议组合格式:通联商户号 + 时间戳 + 固定位数顺序流水号,不包含+号);balance为 1 ~ 64 位不能重复的数字字母组合,支持"-"和"_"。 | 
| amount required int | 付款金额,相关渠道的限额,请查看帮助中心。单位为对应币种的最小货币单位,例如:人民币为分。 | 
| type required string | 付款类型,转账到个人用户为 b2c,转账到企业用户为 b2b(wx、wx_pub、wx_lite 和 balance 渠道的企业付款,仅支持 b2c)。 | 
| currency required string | 三位 ISO 货币代码,目前仅支持人民币: cny。 | 
| recipient conditional string | 接收者 id,使用微信企业付款到零钱时必传,为用户在 wx、wx_pub及wx_lite渠道下的open_id,使用微信企业付款到银行卡时不需要此参数;渠道为alipay时,若 type 为 b2c,为个人支付宝账号,若 type 为 b2b,为企业支付宝账号;渠道为unionpay时不支持传该参数;渠道为allinpay时可不传该参数。渠道为balance时,为用户在当前 app 下的用户 id。 | 
| description required string | 备注信息,最多 255 个 Unicode 字符。渠道为 unionpay时,最多 99 个 Unicode 字符,不可包含特殊字符;渠道为wx、wx_pub、wx_lite时,最多 99 个英文和数字的组合或最多 33 个中文字符,不可包含特殊字符;渠道为alipay时,最多 100 个 Unicode 字符;渠道为allinpay时,最多 30 个 Unicode 字符;渠道为balance时,最多 255 个 Unicode 字符。 | 
| metadata optional hash | 参考元数据。 | 
| extra conditional hash | 相关的附加参数,详情参考 extra 参数说明 。 | 
extra 参数说明
| 参数 | 说明 | 
|---|---|
| user_name conditional,string | 收款人姓名。当该参数为空,则不校验收款人姓名。使用企业付款至个人银行卡时,该参数必传。 | 
| force_check optional,boolean | 是否强制校验收款人姓名。仅当 user_name参数不为空时该参数生效。使用企业付款至个人银行卡时,该参数无效。 | 
| card_number optional,string | 收款人银行卡号。传入该参数时,表示使用企业付款至个人银行卡。不能与 recipient参数同时传入。 | 
| wx_bank_code conditional,string | 开户银行编号。使用企业付款至个人银行卡时,该参数必传。详情请参考微信企业付款银行编号列表。 | 
| scene_id conditional,string | 转账场景ID(商家转账到零钱和商家转账产品必须填写) | 
| product_code optional string | 微信商家转账产品名称,商家转账产品值固定为 merchant_transfer其他产品请勿填写 | 
| receive_perception optional string | 用户收款感知(商家转账产品支持) | 
| scene_report_infos[*]optional list | 转账场景报备信息(商家转账产品支持) | 
| scene_report_infos[*][info_type]optional string | 转账场景报备信息-信息类型 | 
| scene_report_infos[*][info_content]optional string | 转账场景报备信息-信息内容 | 
| wx_app_id optional,string | 微信应用 id | 
| 参数 | 说明 | 
|---|---|
| recipient_name required string | 1.0 接口时必填,2.0 接口时选填,收款人姓名;3.0 在 recipient_account_type 为 ALIPAY_LOGONID 时, recipient_name 参数必须填写, recipient_account_type 为 ALIPAY_USERID 时, recipient_name 参数为可选填参数 | 
| recipient_account_type optional,string | 3.0 必填;收款方账户类型。可取值: 1、ALIPAY_USERID:支付宝账号对应的支付宝唯一用户号。以 2088 开头的 16 位纯数字组成。 2、ALIPAY_LOGONID(默认值):支付宝登录号,支持邮箱和手机号格式。ALIPAY_LOGONID:支付宝登录号,支持邮箱和手机号格式。 | 
| order_title optional,string | 3.0 可选参数,转账业务的标题,用于在支付宝用户的账单里显示(仅 3.0 支持) | 
| 参数 | 说明 | 
|---|---|
| card_number required string | 1~32位,收款人银行卡号或者存折号。 | 
| user_name required string | 1~100位,收款人姓名。 | 
| open_bank_code required string | 4位,开户银行编号,详情请参考通联代付银行编号说明。 | 
| business_code optional,string | 5位,业务代码,根据通联业务人员提供,不填使用通联提供默认值 09900。详情请参考通联代付业务代码说明。 | 
| card_type optional,string | 1位,银行卡号类型。0:银行卡、1:存折、2:信用卡。不填默认使用银行卡。 | 
| sub_bank conditional,string | B2B 转账必填,1~80位,开户行详细名称,也叫网点,如:中国建设银行广州东山广场分理处。详情请下载 支付行号 。 | 
| sub_bank_code conditional,string | B2B 转账必填,1~12位,支付行号。详情请下载 支付行号 。 | 
| prov conditional,string | B2B 转账必填,1~20位,省份,不带 “省” 或 “自治区”,需填写成:广东、广西、内蒙古等。详情请参考 中国邮政区号表 内的「省洲名称」列的内容填写。 | 
| city conditional,string | B2B 转账必填,1~40位,城市,不带 “市”,需填写成:广州、南宁等。如果是直辖市,则填区,如北京(市)朝阳(区)。详情请参考 中国邮政区号表 内的「地区名称」列的内容填写。 | 
| 参数 | 说明 | 
|---|---|
| card_number required string | 1~32位,收款人银行卡号或者存折号。 | 
| user_name required string | 1~100位,收款人姓名。 | 
| open_bank_code optional,string | 4位,开户银行编号,详情请参考银联电子代付银行编号说明。 | 
| open_bank optional,string | 1~50位,开户银行。 | 
| prov optional,string | 1~20位,省份。 | 
| city optional,string | 1~40位,城市。 | 
| sub_bank optional,string | 1~80位,开户支行名称。 | 
注:open_bank_code 和 open_bank 两个参数必传一个,建议使用 open_bank_code ,若都传参则优先使用 open_bank_code 读取规则;prov 和 city 均为可选参数,如果不传参,则使用默认值 "上海" 给渠道接口。
返回
同步返回付款支付结果。如果发生错误,则会返回错误码和错误详情,详见 错误。
POST https://api.pingxx.com/v1/transfers
\Pingpp\Transfer::create();
Transfer.create();
Pingpp::transfers.create()
pingpp.transfers.create();
pingpp.transfers.create();
transfers.New()
create(Dictionary<String, Object> params)curl https://api.pingxx.com/v1/transfers \ -u sk_test_ibbTe5jLGCi5rzfH4OqPW9KC: \ -d order_no=123456789 \ -d app[id]=app_1Gqj58ynP0mHeX1q \ -d channel=wx_pub \ -d amount=100 \ -d currency=cny \ -d type=b2c \ -d recipient=Openid \ -d description="Your Description"
\Pingpp\Pingpp::setApiKey('sk_test_ibbTe5jLGCi5rzfH4OqPW9KC');
\Pingpp\Transfer::create(
    array(
        'order_no'    => '123456789',
        'app'         => array('id' => 'app_1Gqj58ynP0mHeX1q'),
        'channel'     => 'wx_pub',
        'amount'      => 100,
        'currency'    => 'cny',
        'type'        => 'b2c',
        'recipient'   => 'Openid',
        'description' => 'Your Description'
    )
);Pingpp.apiKey = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC";
Map<String, Object> transfer = new HashMap<String, Object>();
transfer.put("amount", 100);
transfer.put("currency", "cny");
transfer.put("type",  "b2c");
transfer.put("order_no",  "123456789");
transfer.put("channel",  "wx_pub");
transfer.put("recipient", "Openid");
transfer.put("description", "Your Description");
Map<String, String> app = new HashMap<String, String>();
app.put("id", "app_1Gqj58ynP0mHeX1q");
transfer.put("app", app);
Transfer transfer = Transfer.create(transfer);require "pingpp"
Pingpp.api_key = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"
Pingpp::Transfer.create(
  :amount   => 100,
  :order_no => "123456789",
  :channel  => "wx_pub",
  :currency => "cny",
  :type=> 'b2c',
  :app => {:id => "app_1Gqj58ynP0mHeX1q"},
  :recipient  => "Openid",
  :description => "Your Description"
)var pingpp = require('pingpp')('sk_test_ibbTe5jLGCi5rzfH4OqPW9KC');
pingpp.transfers.create({
  order_no:    "123456789",
  app:         { id: "app_1Gqj58ynP0mHeX1q" },
  channel:     "wx_pub",
  amount:      100,
  currency:    "cny",
  type:        "b2c",
  recipient:   "Openid",
  description: "Your Description"
}, function(err, transfer) {
  // YOUR CODE
});tr = pingpp.Transfer.create(
   order_no='123456789',
   channel='wx_pub',
   amount=100,
   type='b2c',
   currency='cny',
   app=dict(id='app_1Gqj58ynP0mHeX1q'),
   recipient='Openid',
   description='Your Description'
)  params :=&pingpp.TransferParams{
    Order_no:    "123456789",
    App:         pingpp.App{Id: "app_1Gqj58ynP0mHeX1q"},
    Amount:      100,
    Channel:     "wx_pub",
    Currency:    "cny",
    Type:        "b2c",
    Recipient:   "Openid",
    Description: "Your Description",
  }
  transfer, err := transfer.New(params)Dictionary<String, String> app = new Dictionary<String, String>();
app.Add("id", "app_1Gqj58ynP0mHeX1q");
Dictionary<String, String> extra = new Dictionary<String, String>();
extra.Add("user_name", "user name");
extra.Add("force_check", false);
Dictionary<String, Object> params = new Dictionary<String, Object>();
params.Add("order_no", "1234567890");
params.Add("amount", 100);
params.Add("channel", "wx_pub");
params.Add("currency", "cny");
params.Add("type", "b2c");
params.Add("recipient", "Your OpenId");
params.Add("description", "Your Description");
params.Add("app", app);
params.Add("extra", extra);
  try {
      Transfer tra = Transfer.create(params);
      Console.WriteLine(tra);
   } catch (Exception e) {
      Console.WriteLine(e.Message.ToString());
}{
  "id": "tr_HqbzHCvLOaL4La1ezHfDWTqH",
  "object": "transfer",
  "type": "b2c",
  "created": 1432724825,
  "time_transferred": null,
  "livemode": true,
  "status": "pending",
  "app": "app_1Gqj58ynP0mHeX1q",
  "channel": "wx_pub",
  "order_no": "123456789",
  "amount": 100,
  "amount_settle": 100,
  "currency": "cny",
  "recipient": "o7zpMs5MW2-52GAy5hRrjdYVCktU",
  "description": "Your Description",
  "transaction_no": "1000018301201505200184147302",
  "failure_msg":null,
  "extra": {
      "user_name": "User Name",
      "force_check": true
     }
}