# Protocol Documentation

## Table of Contents

## alipay.proto

Top

### AlipayTradeAppPayReply

Field | Type | Label | Description
pay_param | string |  | 调起支付的参数

### AlipayTradeAppPayRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS

### AlipayTradePagePayReply

Field | Type | Label | Description
pay_url | string |  | 支付链接

### AlipayTradePagePayRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS
return_url | string |  | 支付成功时返回的URL

### AlipayTradeWapPayReply

Field | Type | Label | Description
pay_url | string |  | 支付链接

### AlipayTradeWapPayRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS
quit_url | string |  | 退出支付时用户返回的URL

### AlipayUniTransferReply

### AlipayUniTransferRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 提现金额，单位：分
fee | int64 |  | 提现手续费，单位：分
description | string |  | 商品描述

### Alipay

Method Name | Request Type | Response Type | Description
WapPay | AlipayTradeWapPayRequest | AlipayTradeWapPayReply | 支付宝wap支付
PagePay | AlipayTradePagePayRequest | AlipayTradePagePayReply | 支付宝电脑网站支付
AppPay | AlipayTradeAppPayRequest | AlipayTradeAppPayReply | 支付宝APP支付
Transfer | AlipayUniTransferRequest | AlipayUniTransferReply | 支付宝转账到个人支付宝账户

## blocks.proto

Top

### Empty

### FetchRequest

Field | Type | Label | Description
page_no | int64 |  | 页数
page_size | int64 |  | 每页记录数
params | FetchRequest.ParamsEntry | repeated | 条件参数,key=val,eg key:category_id=?,vlaue=11

### FetchRequest.ParamsEntry

Field | Type | Label | Description
key | string |  |
value | string |  |

### IdentRequest

Field | Type | Label | Description
id | int64 |  | 唯一ID
identity | string |  | 唯一码

### SearchRequest

Field | Type | Label | Description
keyword | string |  | 关键词

### StatusReply

Field | Type | Label | Description
code | int32 |  | 状态码
message | string |  | 状态说明
details | string |  | 数据
timeseq | int64 |  | 响应时间序列

### VersionRequest

Field | Type | Label | Description
version | int64 |  | 时序版本号

## payment.proto

Top

### CallbackRequest

Field | Type | Label | Description
id | int64 |  | 唯一ID
identity | string |  | 唯一码
callback_status | bool |  | 支付回调状态
callback_msg | string |  | 支付回调结果

### ChargeRequest

Field | Type | Label | Description
amount | int64 |  | 充值金额 单位为分
remark | string |  | 备注
pay_channel | int32 |  | 支付模型：WECHAT，ALIPAY
pay_type | string |  | 支付类型 JSAPI:微信浏览器内支付 APP:app支付 MWEB:H5支付 NATIVE:Native支付,pc端生成二维码供用户扫码支付,QUICK_MSECURITY_PAY:app支付 QUICK_WAP_WAY:手机网站支付 FAST_INSTANT_TRADE_PAY:pc网站支付
desc | string |  | 支付描述
open_id | string |  | 微信用户的OpenID

### OrderRequest

Field | Type | Label | Description
order_no | string |  | 订单号
pay_channel | int32 |  | 支付模型：WECHAT，ALIPAY,BALANCE
pay_type | string |  | 支付类型 JSAPI:微信浏览器内支付 APP:app支付 MINI:小程序 NATIVE:Native支付,pc端生成二维码供用户扫码支付,QUICK_MSECURITY_PAY:app支付 QUICK_WAP_WAY:手机网站支付 FAST_INSTANT_TRADE_PAY:pc网站支付
password | string |  | 支付密码
args | string |  | 相关参数
desc | string |  | 支付描述
open_id | string |  | 微信用户的OpenID

### PaymentItem

Field | Type | Label | Description
order_no | string |  | 订单号
trade_no | string |  | 第三方交易流水号
type | int32 |  | 类型:1充值;2支付电商订单
pay_channel | int32 |  | 支付模型：WECHAT，ALIPAY,BALANCE
pay_type | string |  | 支付类型 JSAPI:微信浏览器内支付 APP:app支付 MINI:小程序 NATIVE:Native支付,pc端生成二维码供用户扫码支付,QUICK_MSECURITY_PAY:app支付 QUICK_WAP_WAY:手机网站支付 FAST_INSTANT_TRADE_PAY:pc网站支付
amount | int64 |  | 充值金额 单位为分
args | string |  | 相关参数
status | int32 |  | 支付状态

### PaymentReply

Field | Type | Label | Description
code | int64 |  |
result | PaymentReply.ResultEntry | repeated | 预支付返回

### PaymentReply.ResultEntry

Field | Type | Label | Description
key | string |  |
value | string |  |

### WayItem

Field | Type | Label | Description
ident | string |  | 支付通道标识
title | string |  | 支付通道标题
intro | string |  | 支付通道说明
args | string |  | 支付通道相关参数

### WayReply

Field | Type | Label | Description
way | WayItem | repeated | 支付通道列表

### WayRequest

Field | Type | Label | Description
platform | string |  | 平台

### Payment

Method Name | Request Type | Response Type | Description
Hello | Empty | PaymentReply |
Way | WayRequest | WayReply | 获取平台支持的支付网关
Get | IdentRequest | PaymentItem | 获取支付的详情
ByOrder | OrderRequest | PaymentReply | 支付-电商订单
ByCharge | ChargeRequest | PaymentReply | 支付-充值
Callback | CallbackRequest | StatusReply | 回调更新支付的结果和状态

## wallet.proto

Top

### AddBankCardRequest

Field | Type | Label | Description
wallet_identity | string |  | 钱包唯一标识
card_no | string |  | 银行卡号
card_owner | string |  | 持卡人姓名
id_card | string |  | 持卡人身份证
phone | string |  | 银行预留的手机号

### ApplyCashRequest

Field | Type | Label | Description
channel | int32 |  | 提现的平台 1、微信 2、支付宝 3、银行卡
amount | int64 |  | 提现金额 单位为分
remark | string |  | 备注

### BankCardInfo

Field | Type | Label | Description
id | int64 |  |
bank_number | string |  | 银行卡号
bank_name | string |  | 银行名
card_owner | string |  | 持卡人姓名
id_card | string |  | 持卡人身份证号
phone | string |  | 银行预留的手机号
bind_id | string |  | 绑定银行卡返回的绑定id
bank_type | string |  | 银行卡类型 DC为储蓄卡，CC为信用卡
bank | string |  | 银行卡所属行
created | string |  | 添加日期

### BindPaymentIDRequest

Field | Type | Label | Description
pay_type | int32 |  | 支付类型：1：微信支付，2：支付宝
auth_code | string |  | 微信授权码

### FinanceEmpty

### GetBankCardReply

Field | Type | Label | Description
data | BankCardInfo | repeated |

### GetWalletReply

Field | Type | Label | Description
passport_identity | string |  | 用户唯一标识
wallet_identity | string |  | 钱包唯一标识
balance | int64 |  | 余额
withdrawal_balance | int64 |  | 可提现余额
status | int32 |  | 状态 -1禁用，1：正常
alipay_id | string |  | 支付宝ID
alipay_name | string |  | 支付宝账户名
wxpay_id | string |  | 微信ID
wxpay_name | string |  | 微信支付账户名
total | GetWalletReply.TotalEntry | repeated | 统计数据输出
created | string |  | 创建时间

### GetWalletReply.TotalEntry

Field | Type | Label | Description
key | string |  |
value | int64 |  |

### GetWalletRequest

Field | Type | Label | Description
is_total_today_in | bool |  | 是否统计今日收入
is_total_today_out | bool |  | 是否统计今日支出
is_total_month_in | bool |  | 是否统计本月收入
is_total_month_out | bool |  | 是否统计本月支出
is_total_all_in | bool |  | 是否统计全部收入
is_total_all_out | bool |  | 是否统计全部支出

### RefundReply

Field | Type | Label | Description
balance | int64 |  | 钱包剩余余额，单位：分
transaction | Transaction |  | 交易记录

### RefundRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 退款金额，单位：分
fee | int64 |  | 手续费， 单位：分
remark | string |  | 交易备注

### RmBankCardRequest

Field | Type | Label | Description
identity | string |  | 银行卡Identity

### SetPayPasswordRequest

Field | Type | Label | Description
passport_identity | string |  | 用户唯一标识
password | string |  | 支付密码

### Transaction

Field | Type | Label | Description
trans_type | int32 |  | 收支类型：-1支出，1：收入
trade_type | int32 |  | 交易类型：1：充值，2：提现，3：消费，4：退款，5：收益
in_trade_no | string |  | 内部流水号
out_trade_no | string |  | 外部流水号，eg：微信、支付宝、银行等
money | int64 |  | 交易金额，单位：分
fee | int64 |  | 手续费，单位：分
pay_channel | int32 |  | 支付模型：WECHAT，ALIPAY,BALANCE
pay_type | string |  | 支付类型 JSAPI:微信浏览器内支付 APP:app支付 MINI:小程序 NATIVE:Native支付,pc端生成二维码供用户扫码支付,QUICK_MSECURITY_PAY:app支付 QUICK_WAP_WAY:手机网站支付 FAST_INSTANT_TRADE_PAY:pc网站支付
created | string |  | 创建时间
remark | string |  | 备注信息

### TransactionsReply

Field | Type | Label | Description
total | int64 |  | 总记录数
records | Transaction | repeated | 数据

### TransactionsRequest

Field | Type | Label | Description
trans_type | int64 |  | 收支类型：-1支出，1：收入
trade_type | int64 |  | 交易类型：1：充值，2：提现，3：消费，4：退款，5：收益
start | string |  | 账单起始日期
end | string |  | 账单截止日期
page | int64 |  | 分页
page_size | int64 |  | 单页容量

### Basic

Method Name | Request Type | Response Type | Description
GetWallet | GetWalletRequest | GetWalletReply | 获取钱包信息
SetPayPassword | SetPayPasswordRequest | StatusReply | 设置支付密码
BindPaymentId | BindPaymentIDRequest | StatusReply | 绑定微信或支付宝账户
Transactions | TransactionsRequest | TransactionsReply | 查询交易记录
AddBankCard | AddBankCardRequest | StatusReply | 添加银行卡
GetBankCard | FinanceEmpty | GetBankCardReply | 获取用户银行卡列表
RmBankCard | RmBankCardRequest | StatusReply | 删除银行卡
ApplyCash | ApplyCashRequest | StatusReply | 申请提现

## wechat.proto

Top

### CallBackReply

Field | Type | Label | Description
code | string |  | 错误码，SUCCESS为清算机构接收成功，FAIL错误码为失败。
message | string |  | 返回信息

### WxCallBackRequest

Field | Type | Label | Description
id | string |  |
create_time | string |  |
resource_type | string |  |
event_type | string |  |
summary | string |  |
resource | WxCallBackResource |  |
SignInfo | WxCallBackSignInfo |  |

### WxCallBackResource

Field | Type | Label | Description
original_type | string |  |
algorithm | string |  |
ciphertext | string |  |
associated_data | string |  |
nonce | string |  |

### WxCallBackSignInfo

Field | Type | Label | Description
transaction_id | string |  |
act_code | string |  |
hall_code | string |  |
hall_belong_mch_id | int64 |  |
card_id | string |  |
code | string |  |
activity_id | string |  |

### WxpayAppPreOrderReply

Field | Type | Label | Description
prepay_id | string |  | 预支付ID，两小时有效
app_id | string |  | 微信app_id
mch_id | string |  | 商户号，用以调起支付

### WxpayAppPreOrderRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS

### WxpayJSAPIPreOrderReply

Field | Type | Label | Description
prepay_id | string |  | 预支付ID，两小时有效
app_id | string |  | 微信app_id
timestamp | string |  | 时间戳
nonce_str | string |  | 随机字符串
sign_type | string |  | 签名方式
sign | string |  | 签名串

### WxpayJSAPIPreOrderRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
auth_code | string |  | 微信授权码
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS
orderNo | string |  | 订单唯一码

### WxpayNativePreOrderReply

Field | Type | Label | Description
code_url | string |  | 二维码URL

### WxpayNativePreOrderRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 充值金额，单位：分
description | string |  | 商品描述
notify_url | string |  | 支付回调URL，公网域名须为HTTPS

### WxpayTransferReply

### WxpayTransferRequest

Field | Type | Label | Description
user_identification | string |  | 用户唯一标识
amount | int64 |  | 提现金额，单位：分
fee | int64 |  | 提现手续费，单位：分
description | string |  | 商品描述
transfer_name | string |  | 提现人真实姓名

### Wechat

Method Name | Request Type | Response Type | Description
JsapiPreOrder | WxpayJSAPIPreOrderRequest | WxpayJSAPIPreOrderReply | 微信JSAPI下单
AppPreOrder | WxpayAppPreOrderRequest | WxpayAppPreOrderReply | 微信APP支付下单
NativePreOrder | WxpayNativePreOrderRequest | WxpayNativePreOrderReply | 微信native二维码支付下单
Transfer | WxpayTransferRequest | WxpayTransferReply | 微信转账到零钱
WxCallback | WxCallBackRequest | CallBackReply | 微信支付回调

## Scalar Value Types

.proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby
double |  | double | double | float | float64 | double | float | Float
float |  | float | float | float | float32 | float | float | Float
int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum
uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required)
uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required)
sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum
fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required)
fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum
sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum
bool |  | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass
string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8)
bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT)