-
Notifications
You must be signed in to change notification settings - Fork 4
Vendor
在币信官网打开创建vendor页面 https://bixin.com/openplatform, 如果还未在币信app做实名认证,则需要去做实名认证,提示如下图:

完成实名认证后,点击创建应用,进去创建页面, 依照要求填写您的应用内容。如下图:

| 名称(name) | 描述(description) |
|---|---|
| 应用账号 | 必填. 账号唯一. |
| 应用名字 | 必填. |
| 应用图标 | 选填. |
| 应用描述 | 选填. |
| 网站网址 | 选填. 平台通过 site_url + '?platform-sid=<sid>' 的方式访问Vendor网站,Vendor网站可拿到sid |
| 回调网址 | 选填. 当有平台相关事件发生,比如用户通过Payment付款,平台调用Vendor的callback_url通知Vendor |
| Bot回调网址 | 选填. |
点击创建后便可在Vendor列表中查看。
创建Vendor后,点击查看应用,便可以获得vendor的相关信息:如下图:

- Vendor Secret: 获取和Vendor交互的access_token
- Vendor AES Key:Vendor交互过程中的数据加密的秘钥
- Web Access Token:和bot交互的Token
您还可以对创建的vendor进行更新操作。您也可以重置右侧的所有Key。
用户同Vendor交互的过程包括网站和币信App两部分.
- 用户在bixin.com网站, 点击连接进入
https://bixin.com/platform/vendor/<vendor_name>/go, 网站将会redirect到vendor.site_url?platform-sessionid=xxxx - vendor.site_url网站拿到platform-sessionid, 调用api:
https://bixin.com/platform/api/v1/user/session/<platform-sessionid>便可获得用户信息, 如下操作:
GET https://bixin.com/platform/api/v1/user/session/cde2dde59cc64f6287661fd7e6a35f95
返回:
{
"username": "freeza",
"vendor.BTC.hold": "10",
"vendor.CNY.hold": "0",
"vendor.CNY.cash": "0",
"fullname": "freeza91",
"id": 1,
"vendor.BTC.cash": "10"
}platform-sessionid会在10分钟后过期,过期后请重复之前的过程,便可重新用户信息。
- 使用
https://bixin.com/platform/token?vendor=<vendor.name>&secret=<vendor.secret>获得access_token(带有expired时间,可重复申请). - 使用上述获得的access_token 访问其他API.
Vendor的信用额度, Vendor的信用额度视情况而定。
Vendor在平台的各种货币余额, 用户充值则增加,用户提现则减少,用户提现金额超过Fund余额+信用额度,则提现不能成功.
用户在一个Vendor中的货币余额,比如BTC 0.5, CNY 1000 这样,由Vendor自行设置, 只用来显示和统计总用户余额,不做提现凭证.
- 充值, 用户向Vendor发送money, 只能通过 Payment(支付)
- 提现, Vendor向用户发送money
用户经过确认然后支付给Vendor,可用于以下用途:
- 直接划转
- 担保交易
用户和Vendor之间的资金流转
- user2vendor, 用户发送money给Vendor, Deposit, 第三方Vendor不能直接划转一个用户的账户,需要通过Payment.
- vendor2user, Vendor发送money给用户, Withdraw
- 理财,用户在Vendor上充值,生成利息后提现。需要同一种货币的充值和提现功能。
- 矿池, 不需要充值,只提现。
- B2C, Vendor是B, 用户充值,获得商品,正常情况下不需要提现,只有退货(refund)情况才需要提现, 平台需要提供担保。
API中 https://bixin.com/platform/api/v1 开头的URL都需要携带access_token访问
access_token 可以通过请求 https://bixin.com/platform/token 获得,需要预存vendor_name和secret。
获取Token
GET https://bixin.com/platform/token/?vendor=hello&secret=09cbdbb7be8a46dc8949c9818c5e9d6c
返回:
{
"access_token": "30e57a621fa2474c914ac7ca6c85cc18",
"expire_in": 259200
}
GET https://bixin.com/platform/api/v1/user/list?access_token=30e57a621fa2474c914ac7ca6c85cc18
参数:
| 名称(name) | 描述(description) |
|---|---|
| access_token | API Token |
| offset | default 0 |
| limit | default 100 |
返回:
{
"has_more": false,
"items": [
{
"username": "freeza",
"vendor.BTC.hold": "10",
"vendor.CNY.hold": "0",
"vendor.CNY.cash": "0",
"fullname": "freeza91",
"id": 1,
"vendor.BTC.cash": "10"
},
],
"offset": 0
}
GET https://bixin.com/platform/api/v1/user/:userid?access_token=30e57a621fa2474c914ac7ca6c85cc18
返回:
{
"username": "freeza",
"vendor.BTC.hold": "10",
"vendor.CNY.hold": "0",
"vendor.CNY.cash": "0",
"fullname": "freeza91",
"id": 1,
"vendor.BTC.cash": "10"
}Vendor可以分配若干个地址,当Vendor创建时生成一个新地址,从链上向vendor打款可以直接增加Vendor的余额并通知到callback地址
GET https://bixin.com/platform/api/v1/address/list?access_token=30e57a621fa2474c914ac7ca6c85cc18
参数:
| 名称(name) | 描述(description) |
|---|---|
| access_token | API Token |
| offset | default 0 |
| limit | default 100 |
返回
{
"has_more": false,
"items": [
"1Mxk2PtNkCY8GspiSRnhmEzDqJw1mDo6M1",
"1Mxk2PtNkCY8GspiSRnhmEzDqJw1mso6Ms"
],
"offset": 0
}
GET https://bixin.com/platform/api/v1/user/session/:sid?access_token=30e57a621fa2474c914ac7ca6c85cc18
返回:
{
"username": "freeza",
"vendor.BTC.hold": "0",
"vendor.CNY.hold": "0",
"target_id": "ef8a77414d904faaaf3355ce91775636",
"vendor.CNY.cash": "0",
"fullname": "freeza91",
"id": 1,
"vendor.BTC.cash": "0"
}
POST https://bixin.com/platform/api/v1/withdraw/create
参数:
| 名称(name) | 描述(description) |
|---|---|
| access_token | API Token |
| user | 必填,数字 |
| currency | 必填 |
| amount | 必填 |
| client_uuid | 必填 |
| reply_transfer_id | 选填 |
| note | 选填 |
| category | 选填 |
| args | 选填 |
返回:
{
"status": "SUCCESS",
"vendor": "hello",
"args": {},
"currency": "BTC",
"user.id": 1,
"id": 13,
"category": "",
"client_uuid": "40e57a621fa2474c914ac7ca6c85cc18",
"note": "",
"amount": "-1",
"reply_transfer_id": 0
}
POST https://bixin.com/platform/api/v1/withdraw/address
参数:
| 名称(name) | 描述(description) |
|---|---|
| access_token | API Token |
| currency | 必填 |
| address | 必填 |
| amount | 必填 |
| client_uuid | 必填 |
| note | 选填 |
返回:
{
u'status': u'SUCCESS',
u'category': u'',
u'vendor': u'abc_com_pool',
u'client_uuid': u'd850a0df32c84767bcaf0b97575f3517',
u'args': {},
u'note': u'2017-12-12payment',
u'currency': u'BTC',
u'amount': u'-0.00345678',
u'user.id': 1,
u'id': 219352,
u'reply_transfer_id': 0
}
注意事项:这里client_uuid是防止重复转账的序列号,多个请求如果是同一个client_uuid,只会执行一次转账
GET https://bixin.com/platform/api/v1/transfer/list?access_token=30e57a621fa2474c914ac7ca6c85cc18
查询参数:
| 名称(name) | 描述(description) |
|---|---|
| access_token | API Token |
| offset | 选填。 default 0 |
| limit | 选填。 default 100 |
| order | 选填。 default asc |
| status | 选填。 'ADMIN_REQUIRED'、'ADMIN_DENIED'、'SUCCESS'。 default is all |
| type | 选填。 'deposit', 'withdraw' |
返回:
{
"has_more": false,
"items": [
{
"status": "SUCCESS",
"vendor": "hello",
"args": { },
"currency": "BTC",
"user.id": 1,
"id": 13,
"category": "",
"client_uuid": "12e57a621fa2474c914ac7ca6c85cc18",
"note": "",
"amount": "-1",
"reply_transfer_id": 0
}
],
offset: 0
}
GET https://bixin.com/platform/api/v1/transfer/:transferid?access_token=30e57a621fa2474c914ac7ca6c85cc18
返回:
{
"status": "SUCCESS",
"vendor": "hello",
"args": { },
"currency": "BTC",
"user.id": 1,
"id": 13,
"category": "",
"client_uuid": "12e57a621fa2474c914ac7ca6c85cc18",
"note": "",
"amount": "-1",
"reply_transfer_id": 0
}