业务说明
支持的交易类型:
4.2条码支付、4.3扫码支付、4.13jsapi支付、4.14微信小程序支付、4.21聚合动态码支付、4.22小程序支付收银台下单
接口会根据支付订单情况自动判断退款或撤销。退款交易适用于已成功的支付交易,有效期一般有几个月,不同的支付平台有所差异;撤销适用于所有状态的支付交易,但是有效期只有24小时。
交易请求报文
JSON:
{
"request_type": "barcode_reverse_request",
"isspid": "39493002",
"pos_id": "8888888888",
"store_id": "8888888888",
"pos_seq": "2018121400000006",
"user_id": "user01",
"system_id": "8888",
"memo": "订单备注",
"barcode_reverse_request": {
"pay_type": "502",
"tx_amt": "1",
"org_pos_seq": "2018121400000001",
"notify_url": "http://www.baidu.com/",
"goods_detail": [
{
"goods_id": "apple-01",
"payment_goods_id": "20010001",
"goods_name": "ipad",
"quantity": 1,
"price": 200000,
"goods_category": "34543238",
"body": "特价手机",
"show_url": "http://www.alipay.com/xxx.jpg"
},
{
"goods_id": "apple-02",
"payment_goods_id": "20010002",
"goods_name": "ipad2",
"quantity": 1,
"price": 200000,
"goods_category": "34543239",
"body": "特价手机2",
"show_url": "http://www.alipay.com/xxx2.jpg"
}
],
"extend_params": {
"split_info": {
"keep_amt": "800",
"split_list": [
{
"merchant_id": "10000000000001",
"div_amt": "150"
},
{
"merchant_id": "10000000000002",
"div_amt": "50"
}
]
}
}
},
"sign": "E622B688C360F8444788740B111E4787"
}
XML:
<?xml version="1.0" encoding="GBK"?>
<business_trans>
<request_type>barcode_reverse_request</request_type>
<isspid>39493002</isspid>
<pos_id>1511300001</pos_id>
<store_id>1511300001</store_id>
<pos_seq>1511300000004</pos_seq>
<user_id>user01</user_id>
<system_id>8888</system_id>
<memo>订单备注</memo>
<barcode_reverse_request>
<pay_type>502</pay_type>
<tx_amt>10</tx_amt>
<org_pos_seq>1511300000001</org_pos_seq>
<notify_url><![CDATA[http://www.baidu.com/]]></notify_url>
<goods_detail><![CDATA[商品信息(JSON)]]></goods_detail>
<extend_params><![CDATA[扩展参数]]></extend_params>
</barcode_reverse_request>
</business_trans>
交易请求报文说明
节点名称 | 中文名称 | 类型 | 说明 | 是否必填 |
---|---|---|---|---|
sign | 报文签名 | String(32) | 请求报文格式为JSON时必填 计算签名方式请看2.1章节 | 可选 |
request_type | 请求类型 | String(32) | 固定值:barcode_reverse_request | 必填 |
isspid | 商户号 | String(8) | 翼码商户号,由翼码提供 | 必填 |
pos_id | 终端号 | String(20) | 商户自定义终端号 | 必填 |
store_id | 门店号 | String(20) | 商户自定义门店号 | 必填 |
pos_seq | 退款请求流水号 | String(32) | 同一个翼码商户号下唯一,不可重复使用,且大于12位 | 必填 |
user_id | 操作员标识 | String(20) | 操作员号 | 可空 |
system_id | 系统平台号 | String(4) | 由翼码提供 | 必填 |
memo | 订单备注 | String(128) | 可空 | |
barcode_reverse_request ->pay_type | 支付类型 | String(3) | 502:支付宝 503:微信支付 512:银联二维码 515:微信小程序 516:数字人民币 519:会员余额支付 521:聚分期 | 可空 |
barcode_reverse_request ->tx_amt | 退款金额 | Number(9) | 退款金额,单位为分,不支持小数点 | 必填 |
barcode_reverse_request ->org_pos_seq | 支付请求流水号 | String(32) | 被退款的支付请求流水号,且大于12位 | 必填 |
barcode_reverse_request ->goods_detail | 退款商品信息 | JSONArray | 需要退款的商品信息列表,详细参数见下表 使用XML格式报文时,建议使用CDATA标签包裹内容 | 可空 |
barcode_reverse_request ->extend_params | 扩展参数 | JSON | 用于扩展一些特殊的支付参数字段,详细参数见下表 使用XML格式报文时,建议使用CDATA标签包裹内容 | 可空 |
barcode_reverse_request ->notify_url | 异步通知地址 | String(256) | 异步通知文档见4.20 使用XML格式报文时,建议使用CDATA标签包裹内容 退款结果通知仅支持部分通道 | 可空 |
goods_detail 商品信息 (JSONArray)
JSON节点 | 类型 | 说明 | 是否必填 | 范例 |
---|---|---|---|---|
goods_id | String(32) | 商品的编号 | 必填 | apple-01 |
payment_goods_id | String(32) | 支付平台商品编号 | 可空 | 20010001 |
goods_name | String(256) | 商品名称 | 必填 | ipad |
quantity | Number(9) | 商品数量 | 必填 | 1 |
price | Number(8) | 商品单价,单位为分 | 必填 | 200000 |
goods_category | String(24) | 商品类目 仅支付宝、银联二维码时生效 | 可空 | 34543238 |
body | String(1000) | 商品描述信息 仅支付宝时生效 | 可空 | 特价手机 |
show_url | String(400) | 商品的展示地址 仅支付宝时生效 | 可空 | http://www.alipay.com/xxx.jpg |
addn_info | String(100) | 附加信息 仅银联二维码时生效 | 可空 | 商品图片 http://www.95516.com/xxx.jpg |
goods_detail 样例:
[
{
"goods_id" : "apple-01",
"payment_goods_id" : "20010001",
"goods_name" : "ipad",
"quantity" : 1,
"price" : 200000,
"goods_category" : "34543238",
"body" : "特价手机",
"show_url" : "http://www.alipay.com/xxx.jpg",
"addn_info" : "商品图片 http://www.95516.com/xxx.jpg"
},
{
"goods_id" : "apple-02",
"payment_goods_id" : "20010002",
"goods_name" : "ipad2",
"quantity" : 1,
"price" : 200000,
"goods_category" : "34543239",
"body" : "特价手机2",
"show_url" : "http://www.alipay.com/xxx2.jpg",
"addn_info" : "商品图片 http://www.95516.com/xxx.jpg"
}
]
extend_params 扩展参数 (JSON)
JSON节点 | 类型 | 说明 | 是否必填 | 范例 |
---|---|---|---|---|
split_info | JSON | 分账信息 接口指定分账规则进行实时分账的交易在部分退款时,退款必须传入分账信息,否则会报错。 部分支付通道不支持分账金额退回。 | 可空 |
split_info 分账信息
JSON节点 | 类型 | 说明 | 是否必填 | 范例 |
---|---|---|---|---|
keep_amt | String | 从分账方自留金额中退款的金额,单位为分,可传0表示不从自留中退 | 必填 | 1000 |
split_list | Array | 分账明细 | 可空 |
split_list 分账明细
JSON节点 | 类型 | 说明 | 是否必填 | 范例 |
---|---|---|---|---|
merchant_id | String | 分账接收方的分账商户号 | 必填 | 10000000000001 |
div_amt | String | 从分账金额中退款的金额,单位为分,必须大于0 | 必填 | 1000 |
extend_params 样例:
{
"split_info": {
"keep_amt": "800",
"split_list": [
{
"merchant_id": "10000000000001",
"div_amt": "150"
},
{
"merchant_id": "10000000000002",
"div_amt": "50"
}
]
}
}
交易返回报文
JSON:
{
"response_type": "barcode_reverse_response",
"system_id": "8888",
"isspid": "39493002",
"pos_id": "8888888888",
"pos_seq": "2018121400000006",
"trans_time": "20181214145332",
"sys_seq": "b7ff9fa5bb4355e2",
"pay_type": "502",
"extend": "",
"buss_discount_amt": 0,
"platform_discount_amt": 0,
"fund_freeze_stat": "",
"alipay_res_info": {
"trade_no": "2018121422001429700548119225",
"out_trade_no": "2018121400000001",
"detail_error_code": "",
"detail_error_desc": "",
"send_back_fee": "1",
"charge_amount": "0",
"gmt_refund_pay": "20181214145333"
},
"wxpay_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"app_id": "wx5acb63e448b4fc22",
"mch_id": "1241109502",
"detail_error_code": "",
"detail_error_desc": "",
"send_back_fee": "1",
"settlement_total_fee": "",
"settlement_refund_fee": "",
"charge_amount": "0",
"gmt_refund_pay": "20181214150712"
},
"wxapp_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"app_id": "wx5acb63e448b4fc22",
"mch_id": "1241109502",
"detail_error_code": "",
"detail_error_desc": "",
"send_back_fee": "1",
"settlement_total_fee": "",
"settlement_refund_fee": "",
"charge_amount": "0",
"gmt_refund_pay": "20181214150712"
},
"upay_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"charge_amount": "0"
},
"ecny_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"refund_amount": "1",
"do_refund_amount": "1",
"charge_amount": "0",
"gmt_refund_pay": "20210205111441",
"detail_error_code": "",
"detail_error_desc": ""
},
"balpay_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"refund_amount": "1",
"charge_amount": "0",
"gmt_refund_pay": "20210205111441",
"member_id": "1452"
},
"jfqpay_res_info": {
"trade_no": "4200000196201812146252898537",
"out_trade_no": "2018121400000002",
"refund_amount": "1",
"charge_amount": "0",
"gmt_refund_pay": "20210205111441"
},
"result": {
"id": "0000",
"comment": "交易成功"
},
"sign": "207482F2C0A998B73F388B8AA401DB76"
}
XML:
<?xml version="1.0" encoding="GBK"?>
<business_trans>
<response_type>barcode_reverse_response</response_type>
<isspid>39493002</isspid>
<pos_id>123456789</pos_id>
<pos_seq>000000000001</pos_seq>
<sys_seq>000000000244</sys_seq>
<trans_time>20090405010104</trans_time>
<pay_type>502</pay_type>
<extend><![CDATA[扩展字段(json格式)]]></extend>
<buss_discount_amt>2</buss_discount_amt>
<platform_discount_amt>2</platform_discount_amt>
<fund_freeze_stat></fund_freeze_stat>
<alipay_res_info>
<trade_no>2014110721001004640000791910</trade_no>
<out_trade_no>2014110721001004640000791910</out_trade_no>
<detail_error_code></detail_error_code>
<detail_error_desc></detail_error_desc>
<send_back_fee>1</send_back_fee>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20181115092624</gmt_refund_pay>
</alipay_res_info>
<wxpay_res_info>
<trade_no>4200000196201812146252898537</trade_no>
<out_trade_no>2014110721001004640000791910</out_trade_no>
<app_id>2014110721001004640000791910</app_id>
<mch_id>2014110721001004640000791910</mch_id>
<detail_error_code></detail_error_code>
<detail_error_desc></detail_error_desc>
<send_back_fee>1</send_back_fee>
<settlement_total_fee>1</settlement_total_fee>
<settlement_refund_fee>1</settlement_refund_fee>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20181115092624</gmt_refund_pay>
</wxpay_res_info>
<wxapp_res_info>
<trade_no>4200000196201812146252898537</trade_no>
<out_trade_no>2014110721001004640000791910</out_trade_no>
<app_id>2014110721001004640000791910</app_id>
<mch_id>2014110721001004640000791910</mch_id>
<detail_error_code></detail_error_code>
<detail_error_desc></detail_error_desc>
<send_back_fee>1</send_back_fee>
<settlement_total_fee>1</settlement_total_fee>
<settlement_refund_fee>1</settlement_refund_fee>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20181115092624</gmt_refund_pay>
</wxapp_res_info>
<upay_res_info>
<trade_no>15415906</trade_no>
<out_trade_no>1000000000511</out_trade_no>
<charge_amount>0</charge_amount>
</upay_res_info>
<ecny_res_info>
<trade_no>15415906</trade_no>
<out_trade_no>1000000000511</out_trade_no>
<refund_amount>1</refund_amount>
<do_refund_amount>1</do_refund_amount>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20210205113225</gmt_refund_pay>
<detail_error_code></detail_error_code>
<detail_error_desc></detail_error_desc>
</ecny_res_info>
<balpay_res_info>
<trade_no>15415906</trade_no>
<out_trade_no>1000000000511</out_trade_no>
<refund_amount>1</refund_amount>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20210205111441</gmt_refund_pay>
<member_id>1452</member_id>
</balpay_res_info>
<jfqpay_res_info>
<trade_no>15415906</trade_no>
<out_trade_no>1000000000511</out_trade_no>
<refund_amount>1</refund_amount>
<charge_amount>0</charge_amount>
<gmt_refund_pay>20210205111441</gmt_refund_pay>
</jfqpay_res_info>
<result>
<id>0000</id>
<comment>成功</comment>
</result>
</business_trans>
交易返回报文说明
标准接口会因业务升级需要而新增节点,请在解析返回报文时避免新增未知节点产生的程序出错!
节点名称 | 中文名称 | 类型 | 说明 | 是否必填 |
---|---|---|---|---|
sign | 报文签名 | String(32) | 返回报文格式为JSON时必填 计算签名方式请看2.1章节 | 可选 |
response_type | 返回类型 | String(32) | 固定值:barcode_reverse_response | 必填 |
isspid | 商户号 | String(8) | 翼码商户号,由翼码提供 | 必填 |
pos_id | 终端号 | String(20) | 商户自定义终端号 | 必填 |
pos_seq | 退款请求流水号 | String(32) | 退款请求流水号,和请求报文相同 | 必填 |
sys_seq | 随机串号 | String(16) | 随机生成串号,仅用于日志跟踪用,不保存 | 必填 |
trans_time | 接口返回时间 | String(14) | 接口返回时间,格式:yyyyMMddHHmmss | 必填 |
pay_type | 支付类型 | String(3) | 502:支付宝 503:微信支付 512:银联二维码 515:微信小程序 516:数字人民币 519:会员余额支付 521:聚分期 | 必填 |
extend | 扩展信息 | String | 扩展信息字段内容为json格式 预留字段后续业务扩展使用 | 可空 |
buss_discount_amt | 商家优惠金额 | String(16) | 商家优惠金额,单位为分 | 可空 |
platform_discount_amt | 平台优惠金额 | String(16) | 平台优惠金额,单位为分 | 可空 |
fund_freeze_stat | 资金冻结状态 | String(2) | 退款发生时,对应原支付交易的资金冻结状态 01:冻结 02:解冻 空表示无此类业务 | 可空 |
result ->id | 响应码 | String(4) | 0000:成功 9998:退款处理中,需要调用退款查询交易确认退款结果 其它代表失败,错误信息说明见“响应码解释”字段 | 必填 |
result ->comment | 响应码解释 | String(64) | 响应码对应中文注解,用于显示提示 | 必填 |
支付宝返回以下数据 | ||||
alipay_res_info ->trade_no | 支付宝订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
alipay_res_info ->out_trade_no | 支付商户订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
alipay_res_info ->detail_error_code | 支付详细错误码 | String(48) | ||
alipay_res_info ->detail_error_desc | 支付详细错误码说明 | String(64) | ||
alipay_res_info ->send_back_fee | 卖家退款金额 | String(16) | 本次商户实际退回金额 即退款总金额减去商户优惠退款部分 直连通道交易成功时候,必填,单位为分 | 可空 |
alipay_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
alipay_res_info ->gmt_refund_pay | 退款完成时间 | String(14) | 退款完成时间 | 可空 |
微信支付返回以下数据 | ||||
wxpay_res_info ->trade_no | 微信订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->out_trade_no | 支付商户订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->detail_error_code | 支付详细错误码 | String(48) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->detail_error_desc | 支付详细错误码说明 | String(128) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->app_id | 服务商公众号ID | String(32) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->mch_id | 服务商商户号 | String(32) | 直连通道交易成功时候,必填 | 可空 |
wxpay_res_info ->send_back_fee | 卖家退款金额 | String(16) | 本次商户实际退回金额 即退款总金额减去商户优惠退款部分 直连通道交易成功时候,必填,单位为分 | 可空 |
wxpay_res_info ->settlement_total_fee | 应结订单金额 | String(16) | 单位为分 应结订单金额=订单金额-免充值代金券金额,应结订单金额<=订单金额。 | 可空 |
wxpay_res_info ->settlement_refund_fee | 应结退款金额 | String(16) | 单位为分 去掉非充值代金券退款金额后的应结退款金额,应结退款金额=申请退款金额-非充值代金券退款金额,应结退款金额<=申请退款金额 | 可空 |
wxpay_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
wxpay_res_info ->gmt_refund_pay | 退款完成时间 | String(14) | 退款完成时间 | 可空 |
微信小程序支付返回以下数据 | ||||
wxapp_res_info ->trade_no | 微信订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->out_trade_no | 支付商户订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->detail_error_code | 支付详细错误码 | String(48) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->detail_error_desc | 支付详细错误码说明 | String(128) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->app_id | 服务商公众号ID | String(32) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->mch_id | 服务商商户号 | String(32) | 直连通道交易成功时候,必填 | 可空 |
wxapp_res_info ->send_back_fee | 卖家退款金额 | String(16) | 本次商户实际退回金额 即退款总金额减去商户优惠退款部分 直连通道交易成功时候,必填,单位为分 | 可空 |
wxapp_res_info ->settlement_total_fee | 应结订单金额 | String(16) | 单位为分 应结订单金额=订单金额-免充值代金券金额,应结订单金额<=订单金额。 | 可空 |
wxapp_res_info ->settlement_refund_fee | 应结退款金额 | String(16) | 单位为分 去掉非充值代金券退款金额后的应结退款金额,应结退款金额=申请退款金额-非充值代金券退款金额,应结退款金额<=申请退款金额 | 可空 |
wxapp_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
wxapp_res_info ->gmt_refund_pay | 退款完成时间 | String(14) | 退款完成时间 | 可空 |
银联二维码返回以下数据 | ||||
upay_res_info ->trade_no | 银联订单号 | String(64) | 交易成功的时候,必填 | 可空 |
upay_res_info ->out_trade_no | 支付商户订单号 | String(64) | 交易成功的时候,必填 | 可空 |
upay_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
数字人民币返回以下数据 | ||||
ecny_res_info ->trade_no | 平台订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
ecny_res_info ->out_trade_no | 支付商户订单号 | String(64) | 直连通道交易成功时候,必填 | 可空 |
ecny_res_info ->refund_amount | 退款金额 | String(64) | 直连通道交易成功时候,必填 | 可空 |
ecny_res_info ->do_refund_amount | 已退款金额 | String(64) | 直连通道交易成功时候,必填 | 可空 |
ecny_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
ecny_res_info ->gmt_refund_pay | 退款时间 | String(64) | 直连通道交易成功时候,必填 | 可空 |
ecny_res_info ->detail_error_code | 通道原始应答码,直连通道交易成功时候 | String(64) | 直连通道交易失败时候 | 可空 |
ecny_res_info ->detail_error_desc | 通道原始应答说明,直连通道交易成功时候 | String(64) | 直连通道交易失败时候 | 可空 |
会员余额支付返回以下数据 | ||||
balpay_res_info ->trade_no | 支付平台订单号 | String(64) | 可空 | |
balpay_res_info ->out_trade_no | 支付商户订单号 | String(64) | 可空 | |
balpay_res_info ->refund_amount | 退款金额 | String(9) | 单位为分 | 可空 |
balpay_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
balpay_res_info ->gmt_refund_pay | 退款完成时间 | String(14) | 格式:yyyyMMddHHmmss | 可空 |
balpay_res_info ->member_id | 会员id | String(9) | 可空 | |
聚分期返回以下数据 | ||||
jfqpay_res_info ->trade_no | 支付平台订单号 | String(64) | 可空 | |
jfqpay_res_info ->out_trade_no | 支付商户订单号 | String(64) | 可空 | |
jfqpay_res_info ->refund_amount | 退款金额 | String(9) | 单位为分 | 可空 |
jfqpay_res_info ->charge_amount | 退款手续费 | String(9) | 单位为分,交易成功时必填 | 可空 |
jfqpay_res_info ->gmt_refund_pay | 退款完成时间 | String(14) | 格式:yyyyMMddHHmmss | 可空 |
标准接口会因业务升级需要而新增节点,请在解析返回报文时避免新增未知节点产生的程序出错!