区块链金融API

区块链API

版本:
v0.1

日期:
2017年05月27日

目录

[TOC]

消息字段

//omsId,"LOAN_"+"OMSID_"+时间戳
String id

//借款标题
String titlec

//OMSID
String omsId

//oms name
String omsName

//OMS钱包地址
String omsWalletAddress

//借款人姓名
String borrowerName

//借款人电话
String borrowerPhone

//借款人地址
String borrowerAddress

//借款人身份证号
String borrowerIdCardNumber

//借款人钱包地址
String borrowerWalletAddress

//借款人说明
String borrowerDescription

//10 发售中;20 已满额(待扣投资款);30 已流标;40 待还款;50 待扣还款?;60 已结清;70 已逾期?
int status

//计息方式,暂只支持按年
int rateTimeUnit

//利率(年)
Double rate

//借款额
Double amount

//oms收费,借款人收到资金=amount-omsFee
Double omsFee

//利息总额
Double interestAmount

//还款总额=借款额+利息总额
Double refundAmount

//审批状态,未使用
int approveStatus

//审批时间,未使用
Timestamp approveTime

//期限时间单位,暂时未启用
int periodTimeUnit

//期限,天
int period

//还款方式,暂时只支持到期全款支付
int refundType

//筹标截止时间
Timestamp deadTime

//起息时间,标满开始计息
Timestamp startTime

//计划还款时间,startTime+period
Timestamp refundTime

//实际还款时间
Timestamp realRefoundTime

//已认购金额
Double enterAmount

//已认购笔数
int enterCount

//已还款
Boolean isRefunded

//序列号,未使用
String serialNumber

//合同号,未使用
String contractCode

//合同描述,未使用
String contractDesc

//起投金额
Double startInvestAmount

//递增金额
Double increaseInvestAmount

//区块链txid
String chainTxId

//区块号
String blockId

//描述
String description

//资金用途
String fundUsage

//还款来源
String repaySource

//征信
String creditInformation

//担保信息
String guaranteeInformation
用户
//用户id
String id

//手机号,登录用户
String mobilePhone

//密码
String password

//姓名
String realName

//注册时间
Timestamp registerTime

//身份证号
String idCardNumber

//实名认证状态。0 创建;10 已实名验证;20 已导入钱包
int authStatus

//实名认证时间
Timestamp authTime

//钱包地址
String walletAddress

//钱包pubKey
String walletPubKey

//总资产
Double totalAmount

//可用资产
Double usableAmount

//冻结金额
Double frozenAmount

//投资总收益
Double interestAmount

//投资总笔数
int loanCount

//投资总金额
Double loanAmount

//已回收笔数
int recoveredCount

//已回收总金额
Double recoveredAmount

//已回收的本金
Double recoveredPrincipal

//已回收收益
Double recoveredInterest

//待回收笔数
int unRecoveredCount

//待回收总额
Double unrecoveredAmount

//待回收的本金
Double unRecoveredPrincipal

//待回收的收益
Double unRecoveredInterest
投资
//"INVEST_"+"marketId_"+"13位时间戳"
String id

//标ID
String loanId

//oms id
String omsId

//market Id
String marketId

//投资人id
String investorId

//投资人身份证号
String investorIdCardNumber

//投资人钱包地址
String inverstorWalletAddress

//投资金额
Double amount

//预期收益
Double interestAmount

//回款总金额
Double refundAmount

//10,投资提交20,资金已冻结30,取消投资40,待扣投资款50,待回款60,已还款70,已逾期?
int status

//创建时间
Timestamp createTime

//开始计息时间
Timestamp startTime

//到期时间
Timestamp refoundTime

//实际回款时间
Timestamp realRefoundTime

//区块链txid
String chainTxId

//区块号
String blockId

API

1 OMS

1.1 借款上链

URL

https://apis.qianbao.com/jiedai/v1/oms/loan

Method

POST

Header

Content-type: application/x-www-form-urlencoded;charset=utf-8

RequestBody

"title": "天津买房首付",
"borrowerName": "zz",
"borrowerIdCardNumber": "10100000000000000",
"borrowerWalletAddress": "walet101",
"borrowerPhone": "13888888888",
"borrowerAddress": "北京市朝阳区",
"borrowerDescription": "一个好人",
"amount": 500000,
"omsFee": 5000,
"rate": 0.1,
"period": 90,
"interestAmount": 12328.77,
"deadTime": "2017-07-31 23:59:59",
"startInvestAmount": 10000,
"increaseInvestAmount": 1000,
"description": "good",
"fundUsage": "买房",
"repaySource": "工资",
"creditInformation": "very good",
"guaranteeInformation": "赵老板"

ReponseBody

{
    "status": "20000551",
    "message": "OK"
}
1.2 查询借款列表

URL

https://apis.qianbao.com/jiedai/v1/oms/loans?status={status}

status参数可选

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": [
        {
            "id": "LOAN_oms001_1500606584559",
            "title": "天津买房首付",
            "omsId": "oms001",
            "omsName": "乾元OMS",
            "omsWalletAddress": "wallet_Oms001",
            "borrowerName": "zz",
            "borrowerPhone": "13888888888",
            "borrowerAddress": "北京市朝阳区",
            "borrowerIdCardNumber": "10100000000000000",
            "borrowerWalletAddress": "walet101",
            "borrowerDescription": "一个好人",
            "status": 10,
            "rateTimeUnit": 2,
            "rate": 0.1,
            "amount": 500000,
            "omsFee": 5000,
            "interestAmount": 12328.77,
            "refundAmount": 512328.77,
            "approveStatus": 3,
            "approveTime": 1500606585000,
            "periodTimeUnit": 1,
            "period": 90,
            "refundType": 0,
            "deadTime": 1501516799000,
            "enterAmount": 0,
            "enterCount": 0,
            "isRefunded": false,
            "startInvestAmount": 10000,
            "increaseInvestAmount": 1000,
            "description": "good",
            "fundUsage": "买房",
            "repaySource": "工资",
            "creditInformation": "very good",
            "guaranteeInformation": "赵老板"
        },
        {
            "id": "LOAN_oms001_1500606668343",
            "title": "登录火星",
            "omsId": "oms001",
            "omsName": "乾元OMS",
            "omsWalletAddress": "wallet_Oms001",
            "borrowerName": "gx",
            "borrowerPhone": "13888888888",
            "borrowerAddress": "北京市朝阳区",
            "borrowerIdCardNumber": "10100000000000000",
            "borrowerWalletAddress": "walet101",
            "borrowerDescription": "一个好人",
            "status": 10,
            "rateTimeUnit": 2,
            "rate": 0.1,
            "amount": 500000,
            "omsFee": 5000,
            "interestAmount": 12328.77,
            "refundAmount": 512328.77,
            "approveStatus": 3,
            "approveTime": 1500606669000,
            "periodTimeUnit": 1,
            "period": 90,
            "refundType": 0,
            "deadTime": 1501516799000,
            "enterAmount": 0,
            "enterCount": 0,
            "isRefunded": false,
            "startInvestAmount": 10000,
            "increaseInvestAmount": 1000,
            "description": "good",
            "fundUsage": "火星",
            "repaySource": "火星采矿",
            "creditInformation": "very good",
            "guaranteeInformation": "赵老板"
        }
    ]
}
1.3 查询借款

URL

https://apis.qianbao.com/jiedai/v1/oms/loan/{id}

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "id": "LOAN_oms001_1500606584559",
        "title": "天津买房首付",
        "omsId": "oms001",
        "omsName": "乾元OMS",
        "omsWalletAddress": "wallet_Oms001",
        "borrowerName": "zz",
        "borrowerPhone": "13888888888",
        "borrowerAddress": "北京市朝阳区",
        "borrowerIdCardNumber": "10100000000000000",
        "borrowerWalletAddress": "walet101",
        "borrowerDescription": "一个好人",
        "status": 10,
        "rateTimeUnit": 2,
        "rate": 0.1,
        "amount": 500000,
        "omsFee": 5000,
        "interestAmount": 12328.77,
        "refundAmount": 512328.77,
        "approveStatus": 3,
        "approveTime": 1500606585000,
        "periodTimeUnit": 1,
        "period": 90,
        "refundType": 0,
        "deadTime": 1501516799000,
        "enterAmount": 0,
        "enterCount": 0,
        "isRefunded": false,
        "startInvestAmount": 10000,
        "increaseInvestAmount": 1000,
        "description": "good",
        "fundUsage": "买房",
        "repaySource": "工资",
        "creditInformation": "very good",
        "guaranteeInformation": "赵老板"
    }
}

参数错误
{
    "message": "借款不存在",
    "status": "40400551"
}

2 p2p

2.1 查询借款列表

URL

https://apis.qianbao.com/jiedai/v1/p2p/loans?status={status}

status参数可选

Method

GET

ReponseBody:

参考1.2
2.2 查询借款

URL

curl https://apis.qianbao.com/jiedai/v1/p2p/loans/{id}

Method

GET

ReponseBody:

参考1.3
2.3 注册验证码

URL

https://apis.qianbao.com/jiedai/v1/p2p/register/sms?mobilePhone={mobilePhone}

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK"
}
2.4 注册

URL

https://apis.qianbao.com/jiedai/v1/p2p/register?smsCode=?

Method

POST

Header

Content-type: application/x-www-form-urlencoded;charset=utf-8

RequestBody

"mobilePhone":"18610274382"
"password":"123"

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "token": "667d6b13a2314d5797722adca31aaa34",
        "investorId": "market001_investor_1500610469952"
    }
}
2.5 登录

URL

https://apis.qianbao.com/jiedai/v1/p2p/login

Method

POST

Header

Content-type: application/x-www-form-urlencoded;charset=utf-8

RequestBody

"mobilePhone":"18610274382"
"password":"123"

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "token": "7f9b75c28a264eac8582f3b58c02e3d1",
        "investorId": "market001_investor_1500610469952"
    }
}
2.6 退出登录

URL

https://apis.qianbao.com/jiedai/v1/p2p/logout?QB_AUTH_TOKEN={token}

Method

DELETE

ReponseBody:

{
    "status": "20000551",
    "message": "OK"
}
2.7 实名认证

URL

 https://apis.qianbao.com/jiedai/v1/p2p/investor/auth?QB_AUTH_TOKEN={token}

Method

PUT

Header

"Content-type: application/json;charset=utf-8"

RequestBody

"realName":"高翔"
"idCardNumber":"42012345678901234"

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "id": "market001_investor_1500610469952",
        "mobilePhone": "18610274382",
        "realName": "高翔",
        "registerTime": 1500610470000,
        "idCardNumber": "42012345678901234",
        "authStatus": 10,
        "authTime": 1500610750014,
        "totalAmount": 0,
        "usableAmount": 0,
        "frozenAmount": 0,
        "interestAmount": 0,
        "loanCount": 0,
        "loanAmount": 0,
        "recoveredCount": 0,
        "recoveredAmount": 0,
        "recoveredPrincipal": 0,
        "recoveredInterest": 0,
        "unRecoveredCount": 0,
        "unrecoveredAmount": 0,
        "unRecoveredPrincipal": 0,
        "unRecoveredInterest": 0
    }
}
2.8 导入钱包

URL

https://apis.qianbao.com/jiedai/v1/p2p/investor/wallet?QB_AUTH_TOKEN={token}

Method

PUT

Header

"Content-type: application/json;charset=utf-8"

RequestBody

"walletAddress":"Wallet18610274382"
"walletPubKey":"WalletPubKey001"

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "id": "market001_investor_1500610469952",
        "mobilePhone": "18610274382",
        "realName": "高翔",
        "registerTime": 1500610470000,
        "idCardNumber": "42012345678901234",
        "authStatus": 20,
        "authTime": 1500610750000,
        "walletAddress": "Wallet18610274382",
        "totalAmount": 0,
        "usableAmount": 0,
        "frozenAmount": 0,
        "interestAmount": 0,
        "loanCount": 0,
        "loanAmount": 0,
        "recoveredCount": 0,
        "recoveredAmount": 0,
        "recoveredPrincipal": 0,
        "recoveredInterest": 0,
        "unRecoveredCount": 0,
        "unrecoveredAmount": 0,
        "unRecoveredPrincipal": 0,
        "unRecoveredInterest": 0
    }
}
2.9 当前用户详细信息

URL

https://apis.qianbao.com/jiedai/v1/p2p/investor?QB_AUTH_TOKEN={token}

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "id": "market001_investor_1500610469952",
        "mobilePhone": "18610274382",
        "realName": "高翔",
        "registerTime": 1500610470000,
        "idCardNumber": "42012345678901234",
        "authStatus": 20,
        "authTime": 1500610750000,
        "walletAddress": "Wallet18610274382",
        "totalAmount": 0,
        "usableAmount": 0,
        "frozenAmount": 0,
        "interestAmount": 0,
        "loanCount": 0,
        "loanAmount": 0,
        "recoveredCount": 0,
        "recoveredAmount": 0,
        "recoveredPrincipal": 0,
        "recoveredInterest": 0,
        "unRecoveredCount": 0,
        "unrecoveredAmount": 0,
        "unRecoveredPrincipal": 0,
        "unRecoveredInterest": 0
    }
}
2.10 投资

URL

https://apis.qianbao.com/jiedai/v1/p2p/invest?QB_AUTH_TOKEN={token}

Method

POST

Header

"Content-type: application/json;charset=utf-8"

RequestBody

"loanId":"LOAN_oms001_1500186027844"
"amount":400000

ReponseBody:

{
    "status": "20000551",
    "message": "OK"
}

异常
{
    "message": "可投金额不足",
    "status": "40000551"
}
2.11 用户投资列表

URL

curl https://apis.qianbao.com/jiedai/v1/p2p/invests?status={status}&QB_AUTH_TOKEN={token}

status参数可选

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": [
        {
            "id": "INVEST_market001_1500611289445",
            "loanId": "LOAN_oms001_1500611158732",
            "omsId": "oms001",
            "marketId": "market001",
            "investorId": "market001_investor_1500610469952",
            "investorIdCardNumber": "42012345678901234",
            "inverstorWalletAddress": "Wallet18610274382",
            "amount": 100000,
            "interestAmount": 2465.76,
            "refundAmount": 102465.76,
            "status": 10,
            "createTime": 1500611289000,
            "startTime": 1500611339000,
            "refoundTime": 1508387339000
        },
        {
            "id": "INVEST_market001_1500611339482",
            "loanId": "LOAN_oms001_1500611158732",
            "omsId": "oms001",
            "marketId": "market001",
            "investorId": "market001_investor_1500610469952",
            "investorIdCardNumber": "42012345678901234",
            "inverstorWalletAddress": "Wallet18610274382",
            "amount": 400000,
            "interestAmount": 9863.01,
            "refundAmount": 409863.01,
            "status": 10,
            "createTime": 1500611339000,
            "startTime": 1500611339000,
            "refoundTime": 1508387339000
        }
    ]
}
2.12 查询指定投资

URL

curl https://apis.qianbao.com/jiedai/v1/p2p/invest/{id}?QB_AUTH_TOKEN={token}

Method

GET

ReponseBody:

{
    "status": "20000551",
    "message": "OK",
    "result": {
        "id": "INVEST_market001_1500611289445",
        "loanId": "LOAN_oms001_1500611158732",
        "omsId": "oms001",
        "marketId": "market001",
        "investorId": "market001_investor_1500610469952",
        "investorIdCardNumber": "42012345678901234",
        "inverstorWalletAddress": "Wallet18610274382",
        "amount": 100000,
        "interestAmount": 2465.76,
        "refundAmount": 102465.76,
        "status": 10,
        "createTime": 1500611289000,
        "startTime": 1500611339000,
        "refoundTime": 1508387339000
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,293评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,604评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,958评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,729评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,719评论 5 366
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,630评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,000评论 3 397
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,665评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,909评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,646评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,726评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,400评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,986评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,959评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,197评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 44,996评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,481评论 2 342

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,594评论 18 139
  • REST API 可以让你用任何支持发送 HTTP 请求的设备来与 Parse 进行交互,你可以使用 REST A...
    Caroline嗯哼阅读 1,990评论 0 0
  • Nginx API for Lua Introduction ngx.arg ngx.var.VARIABLE C...
    吃瓜的东阅读 5,708评论 0 5
  • iOS网络架构讨论梳理整理中。。。 其实如果没有APIManager这一层是没法使用delegate的,毕竟多个单...
    yhtang阅读 5,160评论 1 23
  • 为了遇见你 我趟过每一条山涧泉水汇成的小溪 我踏遍每一片芬芳绿意铺就的土地 我叩拜每一座葱郁菩提庇佑的寺宇 寻寻觅...
    刘吖撒阅读 321评论 2 3