获取商户资料
根据商户号查询收款用户的身份信息、豆豆数量
请求地址:https://payjs.cn/api/info
请求参数:
| 字段名称 | 字段类型 | 必填参数 | 说明 | 
|---|---|---|---|
| mchid | string(32) | Y | 商户号 | 
| sign | string(32) | Y | 数据签名 详见签名算法 | 
请求返回:
| 字段名称 | 字段类型 | 必填参数 | 说明 | 
|---|---|---|---|
| return_code | int | Y | 1:请求成功 0:请求失败 | 
| return_msg | string(32) | Y | 返回消息 | 
| doudou | int | Y | 用户豆豆数 | 
| name | string(32) | Y | 商户名称 | 
| jsapi_path | string(32) | Y | JSAPI 支付目录 | 
| phone | string(32) | Y | 联系电话 | 
| sign | string(32) | Y | 数据签名 详见签名算法 | 
该接口字段可能会变化,请勿使用 hardcode
该接口请求频率为6次/分
演示代码:
// 引入 payjs.class.php
// 项目地址:https://github.com/payjs-cn/phpsdk
include("payjs.class.php");
$mchid = '123456';
$key = 'xxxxxx';
$data = [
    "mchid" => $mchid,
];
$payjs = new Payjs($mchid, $key);
$result = $payjs->info($data);
print_r($result);
# !/usr/bin/env Python3
# -*- coding: utf-8 -*-
import requests
import hashlib
from urllib.parse import urlencode,unquote
'''
获取用户资料
'''
mchid = ''        # PAYJS 商户号
key = ''          # 填写通信密钥
order = {
    'mchid'   : mchid
}
# 构造签名函数
def sign(attributes,key):
    attributes_new = {k: attributes[k] for k in sorted(attributes.keys())}
    return hashlib.md5((unquote(urlencode(attributes_new))+'&key='+key)
        .encode(encoding='utf-8')).hexdigest().upper()
order['sign'] = sign(order,key)
request_url = "https://payjs.cn/api/info"
headers = {'content-type': 'application/x-www-form-urlencoded'}
response = requests.post(request_url, data=order,headers=headers)
if response:
    print(response.json())
package main
import (
    "fmt"
    "strings"
    "net/http"
    "net/url"
    "io/ioutil"
)
func main(){
    data := url.Values{"mchid":{"XXX"}, "sign":{"XXX"}}
    data2 := strings.NewReader(data.Encode())
    resp, err := http.Post("https://payjs.cn/api/info", "application/x-www-form-urlencoded", data2)
    if err != nil {
        fmt.Println(err)
    }
    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        // handle error
    }
    fmt.Println(string(body))
}
// 项目地址:https://github.com/payjs-cn/demo-nodejs
// 首先引入文件,并在config.js中配置商户号和通信密钥
var cfg = require("./config.js"); 
var pay = require("./pay.js");
//订单关闭接口  
var params = {
  'mchid': cfg.payjsmchid,     //PAYJS 平台订单号
};
pay.info(params,function (msg) {
  console.log(msg);
  /**TODO 这里处理业务逻辑 */
});
// 完整代码:https://github.com/payjs-cn/demo-java
public Object Info() {
    Map<String,String> payData = new HashMap<>();
    payData.put("mchid", PayjsConfig.mchid);
    // 进行sign签名
    payData.put("sign", sign(payData, PayjsConfig.key));
    // 请求payjs
    String result = HttpsUtils.sendPost(PayjsConfig.infoUrl, JSON.toJSONString(payData),null);
    // 接口返回数据
    return JSON.parseObject(result);
}
// 完整项目地址:https://github.com/payjs-cn/sdk-csharp
Payjs pay = new Payjs("YOUR MCHID", "YOUR KEY");
//返回原始json字符串
string jsonString = pay.info(new Dictionary<string, string>());