接口会根据支付订单情况自动判断退款或撤销。退款交易适用于已成功的支付交易,有效期一般有几个月,不同的支付平台有所差异;撤销适用于所有状态的支付交易,但是有效期只有24小时。

交易请求报文

  1. <?xml version="1.0" encoding="GBK"?>
  2. <business_trans>
  3. <request_type>barcode_reverse_request</request_type>
  4. <isspid>39493002</isspid>
  5. <pos_id>1511300001</pos_id>
  6. <store_id>1511300001</store_id>
  7. <pos_seq>1511300000004</pos_seq>
  8. <user_id>user01</user_id>
  9. <system_id>8888</system_id>
  10. <barcode_reverse_request>
  11. <pay_type>502</pay_type>
  12. <tx_amt>10</tx_amt>
  13. <org_pos_seq>1511300000001</org_pos_seq>
  14. <goods_detail><![CDATA[商品信息(JSON)]]></goods_detail>
  15. <extend_params><![CDATA[扩展参数]]></extend_params>
  16. </barcode_reverse_request>
  17. </business_trans>

交易请求报文说明

节点名称中文名称类型说明是否必填
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)由翼码提供必填
barcode_reverse_request
->pay_type
支付类型String(3)502:支付宝支付
503:微信支付
504:翼支付
507:和包支付
508:和包验证码支付
512:银联二维码
514:招行掌上生活
515:微信小程序
516:数字人民币
519:会员余额支付
传空时自动识别
可空
barcode_reverse_request
->tx_amt
交易金额Number(9)条码支付金额,单位为分,不支持小数点必填
barcode_reverse_request
->org_pos_seq
需要退款交易的流水号String(32)需要退款的原支付流水号,且大于12位必填
barcode_reverse_request
->goods_detail
退款商品信息String(6000)需要退款的商品信息列表,以JSON格式传入
若传入信息带特殊字符请使用CDATA标签包裹内容
详细参数见下表
可空
barcode_reverse_request
->extend_params
扩展参数String用于扩展一些特殊的支付参数字段,以JSON格式传入
XML报文若传入信息带特殊字符请使用CDATA标签包裹内容
详细参数见下表
可空

goods_detail 商品信息 (JSONArray)

参数类型说明是否必填范例
goods_idString(32)商品的编号必填apple-01
payment_goods_idString(32)支付平台商品编号可空20010001
goods_nameString(256)商品名称必填ipad
quantityNumber(9)商品数量必填1
priceNumber(8)商品单价,单位为分必填200000
goods_categoryString(24)商品类目
仅支付宝时生效
可空34543238
bodyString(1000)商品描述信息
仅支付宝时生效
可空特价手机
show_urlString(400)商品的展示地址
仅支付宝时生效
可空http://www.alipay.com/xxx.jpg

goods_detail 样例:

  1. [
  2. {
  3. "goods_id" : "apple-01",
  4. "payment_goods_id" : "20010001",
  5. "goods_name" : "ipad",
  6. "quantity" : 1,
  7. "price" : 200000,
  8. "goods_category" : "34543238",
  9. "body" : "特价手机",
  10. "show_url" : "http://www.alipay.com/xxx.jpg"
  11. },
  12. {
  13. "goods_id" : "apple-02",
  14. "payment_goods_id" : "20010002",
  15. "goods_name" : "ipad2",
  16. "quantity" :"1,
  17. "price" : 200000,
  18. "goods_category" : "34543239",
  19. "body" : "特价手机2",
  20. "show_url" : "http://www.alipay.com/xxx2.jpg"
  21. }
  22. ]

extend_params 扩展参数 (JSON)

JSON节点类型说明是否必填范例
split_infoJSON分账信息
有实时分账的交易在部分退款时,退款必须传入分账信息
部分支付通道不支持分账金额退回
可空 

split_info 分账信息

JSON节点类型说明是否必填范例
keep_amtString从分账方自留金额中退款的金额,单位为分,可传0表示不从自留中退必填1000
split_listArray分账明细可空 
split_list 分账明细
JSON节点类型说明是否必填范例
merchant_idString分账接收方的分账商户号必填10000000000001
div_amtString从分账金额中退款的金额,单位为分,必须大于0必填1000

extend_params 样例:

  1. {
  2. "split_info": {
  3. "keep_amt": "800",
  4. "split_list": [
  5. {
  6. "merchant_id": "10000000000001",
  7. "div_amt": "150"
  8. },
  9. {
  10. "merchant_id": "10000000000002",
  11. "div_amt": "50"
  12. }
  13. ]
  14. }
  15. }

交易返回报文

  1. <?xml version="1.0" encoding="GBK"?>
  2. <business_trans>
  3. <response_type>barcode_reverse_response</response_type>
  4. <isspid>39493002</isspid>
  5. <pos_id>123456789</pos_id>
  6. <pos_seq>000000000001</pos_seq>
  7. <sys_seq>000000000244</sys_seq>
  8. <trans_time>20090405010104</trans_time>
  9. <pay_type>502</pay_type>
  10. <alipay_res_info>
  11. <trade_no>2014110721001004640000791910</trade_no>
  12. <out_trade_no>2014110721001004640000791910</out_trade_no>
  13. <detail_error_code></detail_error_code>
  14. <detail_error_desc></detail_error_desc>
  15. </alipay_res_info>
  16. <wxpay_res_info>
  17. <trade_no>4220010308201904025663166425</trade_no>
  18. <out_trade_no>2014110721001004640000791910</out_trade_no>
  19. <app_id>2014110721001004640000791910</app_id>
  20. <mch_id>2014110721001004640000791910</mch_id>
  21. <settlement_total_fee>10</settlement_total_fee>
  22. <settlement_refund_fee>10</settlement_refund_fee>
  23. <detail_error_code></detail_error_code>
  24. <detail_error_desc></detail_error_desc>
  25. </wxpay_res_info>
  26. <wxapp_res_info>
  27. <trade_no>4220010308201904025663166425</trade_no>
  28. <out_trade_no>2014110721001004640000791910</out_trade_no>
  29. <app_id>2014110721001004640000791910</app_id>
  30. <mch_id>2014110721001004640000791910</mch_id>
  31. <settlement_total_fee>10</settlement_total_fee>
  32. <settlement_refund_fee>10</settlement_refund_fee>
  33. <detail_error_code></detail_error_code>
  34. <detail_error_desc></detail_error_desc>
  35. </wxapp_res_info>
  36. <yzf_res_info>
  37. <out_trade_no>2014110721001004640000791910</out_trade_no>
  38. <detail_error_code>FAIL</detail_error_code>
  39. <detail_error_desc>退款失败</detail_error_desc>
  40. </yzf_res_info>
  41. <cmpay_res_info>
  42. <out_trade_no>0001034843100000001963</out_trade_no>
  43. <detail_error_code></detail_error_code>
  44. <detail_error_desc></detail_error_desc>
  45. <send_back_fee>1</send_back_fee>
  46. </cmpay_res_info>
  47. <umpay_res_info>
  48. <trade_no></trade_no>
  49. <out_trade_no>0001034843100000001964</out_trade_no>
  50. <detail_error_code></detail_error_code>
  51. <detail_error_desc></detail_error_desc>
  52. </umpay_res_info>
  53. <upay_res_info>
  54. <trade_no>15415906</trade_no>
  55. <out_trade_no>1000000000511</out_trade_no>
  56. </upay_res_info>
  57. <cmb_res_info>
  58. <trade_no>190419135176132382298112</trade_no>
  59. <out_trade_no>201904191391123546</out_trade_no>
  60. </cmb_res_info>
  61. <ecny_res_info>
  62. <trade_no>15415906</trade_no>
  63. <out_trade_no>1000000000511</out_trade_no>
  64. </ecny_res_info>
  65. <balpay_res_info>
  66. <trade_no>15415906</trade_no>
  67. <out_trade_no>1000000000511</out_trade_no>
  68. </balpay_res_info>
  69. <result>
  70. <id>0000</id>
  71. <comment>成功</comment>
  72. </result>
  73. </business_trans>

交易返回报文说明

标准接口会因业务升级需要而新增节点,请在解析返回报文时避免新增未知节点产生的程序出错!

节点名称中文名称类型说明是否必填
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:微信支付
504:翼支付
507:和包支付
508:和包验证码支付
512:银联二维码
514:招行掌上生活
515:微信小程序
516:数字人民币
519:会员余额支付
必填
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)
微信支付的时候返回以下数据
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
->settlement_total_fee
应结订单金额String(16)应结订单金额=订单金额-免充值代金券金额,应结订单金额<=订单金额。
单位为分,微信有值时返回
可空
wxpay_res_info
->settlement_refund_fee
退款金额String(16)去掉非充值代金券退款金额后的退款金额,退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额
单位为分,微信有值时返回
可空
wxpay_res_info
->app_id
微信公众帐号String(32)交易成功时候,必填可空
wxpay_res_info
->mch_id
微信商户帐号String(32)交易成功时候,必填可空
微信小程序的时候返回以下数据
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
->settlement_total_fee
应结订单金额String(16)应结订单金额=订单金额-免充值代金券金额,应结订单金额<=订单金额。
单位为分,微信有值时返回
可空
wxapp_res_info
->settlement_refund_fee
退款金额String(16)去掉非充值代金券退款金额后的退款金额,退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额
单位为分,微信有值时返回
可空
wxapp_res_info
->app_id
微信公众帐号String(32)交易成功时候,必填可空
wxapp_res_info
->mch_id
微信商户帐号String(32)交易成功时候,必填可空
翼支付的时候返回以下数据
yzf_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
yzf_res_info
->detail_error_code
支付详细错误码String(48)交易成功时候,必填可空
yzf_res_info
->detail_error_desc
支付详细错误码说明String(128)交易成功时候,必填可空
和包支付的时候返回以下数据
cmpay_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
cmpay_res_info
->send_back_fee
买家退款金额String(16)交易成功时候,必填,单位为分可空
和包验证码支付的时候返回以下数据
umpay_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
银联二维码支付的时候返回以下数据
upay_res_info
->trade_no
支付平台处理流水String(64)交易成功时候,必填可空
upay_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
招行掌上生活的时候返回以下数据
cmb_res_info
->trade_no
支付平台处理流水String(64)交易成功时候,必填可空
cmb_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
数字人民币支付的时候返回以下数据
ecny_res_info
->trade_no
支付平台处理流水String(64)交易成功时候,必填可空
ecny_res_info
->out_trade_no
支付交易请求流水String(64)交易成功时候,必填可空
会员余额支付的时候返回以下数据
balpay_res_info
->trade_no
支付平台订单号String(64)交易成功时候,必填可空
balpay_res_info
->out_trade_no
支付商户订单号String(64)交易成功时候,必填可空

标准接口会因业务升级需要而新增节点,请在解析返回报文时避免新增未知节点产生的程序出错!