Bank Card 2/3/4-Factor Verification
Supports bank card verification at increasing levels — 2-factor (name + card number), 3-factor (+ ID number) and 4-factor (+ mobile number). The level is detected automatically from the parameters provided. Billed per package, 1 deduction per call.
API info
| Item | Value |
|---|
| Endpoint | POST /api/v3/yhkhy |
| Billing | Package |
Request parameters
| Parameter | Type | Required | Description |
|---|
name | string | Yes | Name |
acct_no | string | Yes | Bank card number |
idcard | string | No | ID card number (required for 3-factor / 4-factor) |
phone | string | No | Mobile number (required for 4-factor) |
Request example
PHP
<?php
$app_id = 'YOUR_APP_ID';
$app_key = 'YOUR_APP_KEY';
$url = 'https://yunsapi.com/api/v3/yhkhy';
$params = [
'name' => 'Zhang San',
'acct_no' => '6222020200012345678',
'idcard' => '510107199306284455',
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-APP-ID: ' . $app_id,
'X-APP-KEY: ' . $app_key,
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($ch);
curl_close($ch);
echo $resp;
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class BankCardDemo {
public static void main(String[] args) throws Exception {
String appId = "YOUR_APP_ID";
String appKey = "YOUR_APP_KEY";
String url = "https://yunsapi.com/api/v3/yhkhy";
String body = "{\"name\":\"Zhang San\",\"acct_no\":\"6222020200012345678\",\"idcard\":\"510107199306284455\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("X-APP-ID", appId)
.header("X-APP-KEY", appKey)
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
}
}
Response example
{
"code": 0,
"msg": "success",
"data": {
"state": "1",
"element_type": "3-factor",
"remain": 9
},
"request_id": "req_xxx"
}
Response parameters
| Parameter | Type | Description |
|---|
data.state | string | 1 means verified, 0 means mismatch |
data.element_type | string | The factor level actually verified: 2-factor / 3-factor / 4-factor |
data.remain | integer | Remaining quota in the package |