1、接口规范
Agreement rules
WEB access to PayCloud, calling API must follow the following rules:
| |
---|
Transfer protocol | To ensure transaction security, HTTPS transmission is used, but the test environment can use HTTP transmission |
Submission method | POST/GET |
Data format | JSON |
Character encoding | UTF-8 |
Content-Type | multipart/form-data、application/x-www-form-urlencoded 、application/json |
Domain
2、签名规范
签名算法
签名算法目前只支持RSA(SHA256) ,对请求数据统一签名。
在RSA的签名时,需要私钥和公钥一起参与签名。私钥与公钥皆是客户通过OPENSSL工具(或使用支付宝RSA密钥工具)来生成得出的(注意:生成密钥时JAVA应选择PKCS8格式,其他语言选择PKCS1模式,长度为2048)。
开发者将生成出的RSA公钥(Public Key)提供给微智金服PayCloud平台技术支持人员进行配置,同时也将PayCloud平台的公钥(PayCloud Public Key)设置在商户系统中。当商户系统请求报文签名,或响应报文验证签名时,需要用到自己的私钥及PayCloud平台的公钥。
3、参数定义
Parameter Type | Description | Example |
---|
string | 字符串 | zhangsan |
date | 日期 | 2018-08-02 |
datetime | 时间 | 2018-08-02 15:16:51 |
boolean | 布尔 | true/false |
int | 整数 | 123 |
decimal | 小数 | 123.35 |
JSONObject | JSON对象 | {"key":"value"} |
JSONArray | JSON数组 | [1,2,3,4,5] |
公共参数
3.1、请求参数
Http请求头
KEY | TYPE | MUST | DESCRIPTION |
---|
Accept-Language | string(8) | N | The client can accept languages, such as:en-US,zh-CN |
Content-Type | string(50) | M | application/x-www-form-urlencoded、application/json |
X-Psn | string(50) | N | Interface serial number |
X-Auth-Token | string(50) | N | User login credentials |
3.2、响应参数
Http响应头
KEY | TYPE | MUST | DESCRIPTION |
---|
X-Auth-Token | string(50) | N | User login credentials |
Http响应体
KEY | TYPE | MUST | DESCRIPTION |
---|
code | string(8) | M | Status code, 0 means success, other means failure |
msg | string(128) | M | Error message, when an error occurs, this msg contains the error message |
data | JSON | M | Return data, the specific parameters are defined by each business API |
psn | string(20) | M | Interface serial number |
4、报文示例
请求报文:
{
"userId": "1001"
}
响应报文:
{
"code":"0",
"msg":"success",
"data":{
"username":"zhangsan",
"age":18,
"create_time":"2018-08-02 15:16:51"
},
"psn":"08031010581935425158"
}