独立的第三方接口,请求该接口根据用户的姓名、身份证号、银行卡号、手机号,鉴别其身份真伪。
请求参数 | 描述 |
---|---|
type required string | 身份证信息或者银行卡信息串,取值范围: "id_card"(身份证信息串);"bank_card"(银行卡信息串)。 |
app required string | 应用 ID ,查看如何获取App ID。 |
data required map | 验证数据,包含参数见下表。 |
data 参数说明 | 描述 |
---|---|
id_name required string | 身份证姓名(1~16位)。 |
id_number required string | 身份证号码(15位或18位)。 |
card_number required string | 银行卡号(12~19位),仅在 type 参数为 "bank_card" 时必传,type 参数为 "id_card" 时请勿传此参数。 |
phone_number conditional,string | 手机号(11位),仅在 type 参数为 "bank_card" 时可以选择是否传此参数,暂不支持178开头的手机号。type 参数为 "id_card" 时请勿传此参数。 |
返回
请求成功,返回 result_code
字段为返回码,详情参照API文档附录的认证接口 result_code
说明;message
中是错误描述信息,仅在成功时返回 success
; paid
表示本次调用接口认证是否产生费用, paid
为 true
则需要付费,false
不产生费用,或者返回一个错误,详见 错误。
POST https://api.pingxx.com/v1/identification
\Pingpp\Identification::identify()
Identification result = Identification.identify(params)
Pingpp::Identification.identify()
pingpp.identification.identify()
pingpp.Identification.create(**req_params)
identificationData := map[string]interface{}
Identification.Identify(iParams)
curl https://api.pingxx.com/v1/identification \ -H "Pingplusplus-Signature: SIGNATURE" \ -H "Content-Type: application/json" \ -u sk_live_ibbTe5jLGCi5rzfH4OqPW9KC: \ -d '{ "type": "bank_card", "app": "app_1Gqj58ynP0mHeX1q", "data": { "id_name": "张三", "id_number": "320291198811110000", "card_number": "6201111122223333" } }'
\Pingpp\Identification::identify(array(
'type' => 'id_card',
'app' => $app_id,
'data' => array(
'id_name' => '张三', // 姓名
'id_number' => '310181198910107641' // 身份证号
)
));
\Pingpp\Identification::identify(array(
'type' => 'bank_card',
'app' => $app_id,
'data' => array(
'id_name' => '张三', // 姓名
'id_number' => '310181198910107641', // 身份证号,
'card_number' => '6201111122223333', // 银行卡号
'phone_number' => '18623234545' // 银行预留手机号,暂不支持178开头的手机号。
)
));
/**
* 认证身份证信息
*
* 参考文档:https://www.pingxx.com/api#请求认证接口
*/
public void identifyIdCard() {
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("app", appId);
params.put("type", "id_card"); // 身份证信息或者银行卡信息串,取值范围: "id_card"(身份证信息串);"bank_card"(银行卡信息串)。
Map<String, String> data = new HashMap<String, String>();
data.put("id_name", "张三");
data.put("id_number", "320291198811110000");
params.put("data", data);
Identification result = Identification.identify(params);
if (result.getResultCode() == 0) {
System.out.println("身份认证通过");
} else {
System.out.println(result.getResultCode());
System.out.println(result.getMessage());
}
System.out.println(result);
} catch (AuthenticationException e) {
e.printStackTrace();
} catch (InvalidRequestException e) {
e.printStackTrace();
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIException e) {
e.printStackTrace();
} catch (ChannelException e) {
e.printStackTrace();
}
}
/**
* 认证银行卡信息
*
* 参考文档:https://www.pingxx.com/api#请求认证接口
*/
public void identifyBankCard() {
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("app", appId);
params.put("type", "bank_card"); // 身份证信息或者银行卡信息串,取值范围: "id_card"(身份证信息串);"bank_card"(银行卡信息串)。
Map<String, String> data = new HashMap<String, String>();
data.put("id_name", "张三");
data.put("id_number", "320291198811110000");
data.put("card_number", "6201111122223333");
params.put("data", data);
Identification result = Identification.identify(params);
if (result.getResultCode() == 0) {
System.out.println("银行卡信息认证通过");
} else {
System.out.println(result.getResultCode());
System.out.println(result.getMessage());
}
System.out.println(result);
} catch (AuthenticationException e) {
e.printStackTrace();
} catch (InvalidRequestException e) {
e.printStackTrace();
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIException e) {
e.printStackTrace();
} catch (ChannelException e) {
e.printStackTrace();
}
}
}
Pingpp::Identification.identify(
:type => "id_card",
:app => APP_ID,
:data => {
:id_name => "张三", # 姓名
:id_number => "310181198910107641" # 身份证号
}
)
Pingpp::Identification.identify(
:type => "bank_card",
:app => APP_ID,
:data => {
:id_name => "张三", # 姓名
:id_number => "310181198910107641", # 身份证号
:card_number => "6201111122223333", # 银行卡号
:phone_number => "18623234545" # 银行预留手机号,暂不支持178开头的手机号。
}
)
pingpp.identification.identify(
{
type: 'bank_card',
app: APP_ID,
data: {
id_name: '张三',
id_number: '320291198811110000',
card_number: '6201111122223333'
}
},
function(err, result) {
err && console.log(err.message);
result && console.log(result);
// YOUR CODE
}
)
eq_params = {
"app": app_id,
"data": {
"id_name": "张三",
"id_number": "320291198811110000",
"card_number": "6201111122223333"
},
"type": "bank_card"
}
try:
identification = pingpp.Identification.create(**req_params)
print "identification instance \n", identification
except Exception as e:
print e
func ExampleIdentification_new() {
identificationData := map[string]interface{}{
"id_name": "张三",
"id_number": "370911199703113457",
}
params := &pingpp.IdentificationParams{
Type: identification.IDENTIFY_IDCARD, //IDENTIFY_IDCARD:身份证认证;IDENTIFY_BANKCARD:银行卡信息认证
App: "app_1Gqj58ynP0mHeX1q",
Data: identificationData,
}
result, err := identification.New(params)
if err != nil {
log.Fatal(err)
return
}
fmt.Printf("%#v", result)
if result.ResultCode == 0 {
log.Println("认证成功")
} else {
log.Printf("认证失败,错误码:%d,错误信息:%s", result.ResultCode, result.Message)
}
}
public static void Example(string appId)
{
var iParams = new Dictionary<string, object>
{
{"type", "bank_card"},
{"app", appId},
{"data", new Dictionary<string, object>
{
{"id_name", "张三"}, // 姓名
{"id_number", "310181198910107641"}, // 身份证号
{"card_number", "6201111122223333"}, // 银行卡号
{"phone_number", "18623234545"} // 银行预留手机号,不支持 178 号段
}
}
};
Console.WriteLine("****发起身份认证请求****");
Console.WriteLine(Identification.Identify(iParams));
Console.WriteLine();
}
{
"type": "bank_card",
"app": "app_1Gqj58ynP0mHeX1q",
"result_code": 3441,
"message": "银行卡信息认证失败",
"paid":true,
"data": {
"id_name": "张三",
"id_number": "320291198811110000",
"card_number": "6201111122223333"
}
}