业务说明

支持的交易类型:
4.2条码支付、4.3扫码支付、4.13jsapi支付、4.14微信小程序支付、4.21聚合动态码支付、4.22小程序支付收银台下单

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

交易请求报文

JSON:

  1. {
  2. "request_type": "barcode_reverse_request",
  3. "isspid": "39493002",
  4. "pos_id": "8888888888",
  5. "store_id": "8888888888",
  6. "pos_seq": "2018121400000006",
  7. "user_id": "user01",
  8. "system_id": "8888",
  9. "memo": "订单备注",
  10. "barcode_reverse_request": {
  11. "pay_type": "502",
  12. "tx_amt": "1",
  13. "org_pos_seq": "2018121400000001",
  14. "goods_detail": [
  15. {
  16. "goods_id": "apple-01",
  17. "payment_goods_id": "20010001",
  18. "goods_name": "ipad",
  19. "quantity": 1,
  20. "price": 200000,
  21. "goods_category": "34543238",
  22. "body": "特价手机",
  23. "show_url": "http://www.alipay.com/xxx.jpg"
  24. },
  25. {
  26. "goods_id": "apple-02",
  27. "payment_goods_id": "20010002",
  28. "goods_name": "ipad2",
  29. "quantity": 1,
  30. "price": 200000,
  31. "goods_category": "34543239",
  32. "body": "特价手机2",
  33. "show_url": "http://www.alipay.com/xxx2.jpg"
  34. }
  35. ],
  36. "extend_params": {
  37. "split_info": {
  38. "keep_amt": "800",
  39. "split_list": [
  40. {
  41. "merchant_id": "10000000000001",
  42. "div_amt": "150"
  43. },
  44. {
  45. "merchant_id": "10000000000002",
  46. "div_amt": "50"
  47. }
  48. ]
  49. }
  50. }
  51. },
  52. "sign": "E622B688C360F8444788740B111E4787"
  53. }

XML:

  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. <memo>订单备注</memo>
  11. <barcode_reverse_request>
  12. <pay_type>502</pay_type>
  13. <tx_amt>10</tx_amt>
  14. <org_pos_seq>1511300000001</org_pos_seq>
  15. <goods_detail><![CDATA[商品信息(JSON)]]></goods_detail>
  16. <extend_params><![CDATA[扩展参数]]></extend_params>
  17. </barcode_reverse_request>
  18. </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标签包裹内容
可空

goods_detail 商品信息 (JSONArray)

JSON节点类型说明是否必填范例
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
addn_infoString(100)附加信息
仅银联二维码时生效
可空商品图片 http://www.95516.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. "addn_info" : "商品图片 http://www.95516.com/xxx.jpg"
  12. },
  13. {
  14. "goods_id" : "apple-02",
  15. "payment_goods_id" : "20010002",
  16. "goods_name" : "ipad2",
  17. "quantity" : 1,
  18. "price" : 200000,
  19. "goods_category" : "34543239",
  20. "body" : "特价手机2",
  21. "show_url" : "http://www.alipay.com/xxx2.jpg",
  22. "addn_info" : "商品图片 http://www.95516.com/xxx.jpg"
  23. }
  24. ]

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. }

交易返回报文

JSON:

  1. {
  2. "response_type": "barcode_reverse_response",
  3. "system_id": "8888",
  4. "isspid": "39493002",
  5. "pos_id": "8888888888",
  6. "pos_seq": "2018121400000006",
  7. "trans_time": "20181214145332",
  8. "sys_seq": "b7ff9fa5bb4355e2",
  9. "pay_type": "502",
  10. "extend": "<![CDATA[]]>",
  11. "buss_discount_amt": 0,
  12. "platform_discount_amt": 0,
  13. "alipay_res_info": {
  14. "trade_no": "2018121422001429700548119225",
  15. "out_trade_no": "2018121400000001",
  16. "detail_error_code": "",
  17. "detail_error_desc": "",
  18. "send_back_fee": "1",
  19. "charge_amount": "0",
  20. "gmt_refund_pay": "20181214145333"
  21. },
  22. "wxpay_res_info": {
  23. "trade_no": "4200000196201812146252898537",
  24. "out_trade_no": "2018121400000002",
  25. "app_id": "wx5acb63e448b4fc22",
  26. "mch_id": "1241109502",
  27. "detail_error_code": "",
  28. "detail_error_desc": "",
  29. "send_back_fee": "1",
  30. "settlement_total_fee": "",
  31. "settlement_refund_fee": "",
  32. "charge_amount": "0",
  33. "gmt_refund_pay": "20181214150712"
  34. },
  35. "wxapp_res_info": {
  36. "trade_no": "4200000196201812146252898537",
  37. "out_trade_no": "2018121400000002",
  38. "app_id": "wx5acb63e448b4fc22",
  39. "mch_id": "1241109502",
  40. "detail_error_code": "",
  41. "detail_error_desc": "",
  42. "send_back_fee": "1",
  43. "settlement_total_fee": "",
  44. "settlement_refund_fee": "",
  45. "charge_amount": "0",
  46. "gmt_refund_pay": "20181214150712"
  47. },
  48. "upay_res_info": {
  49. "trade_no": "4200000196201812146252898537",
  50. "out_trade_no": "2018121400000002",
  51. "charge_amount": "0"
  52. },
  53. "ecny_res_info": {
  54. "trade_no": "4200000196201812146252898537",
  55. "out_trade_no": "2018121400000002",
  56. "refund_amount": "1",
  57. "do_refund_amount": "1",
  58. "charge_amount": "0",
  59. "gmt_refund_pay": "20210205111441",
  60. "detail_error_code": "",
  61. "detail_error_desc": ""
  62. },
  63. "balpay_res_info": {
  64. "trade_no": "4200000196201812146252898537",
  65. "out_trade_no": "2018121400000002",
  66. "refund_amount": "1",
  67. "charge_amount": "0",
  68. "gmt_refund_pay": "20210205111441",
  69. "member_id": "1452",
  70. },
  71. "jfqpay_res_info": {
  72. "trade_no": "4200000196201812146252898537",
  73. "out_trade_no": "2018121400000002",
  74. "refund_amount": "1",
  75. "charge_amount": "0",
  76. "gmt_refund_pay": "20210205111441",
  77. },
  78. "result": {
  79. "id": "0000",
  80. "comment": "交易成功"
  81. },
  82. "sign": "207482F2C0A998B73F388B8AA401DB76"
  83. }

XML:

  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. <extend><![CDATA[扩展字段(json格式)]]></extend>
  11. <buss_discount_amt>2</buss_discount_amt>
  12. <platform_discount_amt>2</platform_discount_amt>
  13. <alipay_res_info>
  14. <trade_no>2014110721001004640000791910</trade_no>
  15. <out_trade_no>2014110721001004640000791910</out_trade_no>
  16. <detail_error_code></detail_error_code>
  17. <detail_error_desc></detail_error_desc>
  18. <send_back_fee>1</send_back_fee>
  19. <charge_amount>0</charge_amount>
  20. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  21. </alipay_res_info>
  22. <wxpay_res_info>
  23. <trade_no>4200000196201812146252898537</trade_no>
  24. <out_trade_no>2014110721001004640000791910</out_trade_no>
  25. <app_id>2014110721001004640000791910</app_id>
  26. <mch_id>2014110721001004640000791910</mch_id>
  27. <detail_error_code></detail_error_code>
  28. <detail_error_desc></detail_error_desc>
  29. <send_back_fee>1</send_back_fee>
  30. <settlement_total_fee>1</settlement_total_fee>
  31. <settlement_refund_fee>1</settlement_refund_fee>
  32. <charge_amount>0</charge_amount>
  33. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  34. </wxpay_res_info>
  35. <wxapp_res_info>
  36. <trade_no>4200000196201812146252898537</trade_no>
  37. <out_trade_no>2014110721001004640000791910</out_trade_no>
  38. <app_id>2014110721001004640000791910</app_id>
  39. <mch_id>2014110721001004640000791910</mch_id>
  40. <detail_error_code></detail_error_code>
  41. <detail_error_desc></detail_error_desc>
  42. <send_back_fee>1</send_back_fee>
  43. <settlement_total_fee>1</settlement_total_fee>
  44. <settlement_refund_fee>1</settlement_refund_fee>
  45. <charge_amount>0</charge_amount>
  46. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  47. </wxapp_res_info>
  48. <upay_res_info>
  49. <trade_no>15415906</trade_no>
  50. <out_trade_no>1000000000511</out_trade_no>
  51. <charge_amount>0</charge_amount>
  52. </upay_res_info>
  53. <ecny_res_info>
  54. <trade_no>15415906</trade_no>
  55. <out_trade_no>1000000000511</out_trade_no>
  56. <refund_amount>1</refund_amount>
  57. <do_refund_amount>1</do_refund_amount>
  58. <charge_amount>0</charge_amount>
  59. <gmt_refund_pay>20210205113225</gmt_refund_pay>
  60. <detail_error_code></detail_error_code>
  61. <detail_error_desc></detail_error_desc>
  62. </ecny_res_info>
  63. <balpay_res_info>
  64. <trade_no>15415906</trade_no>
  65. <out_trade_no>1000000000511</out_trade_no>
  66. <refund_amount>1</refund_amount>
  67. <charge_amount>0</charge_amount>
  68. <gmt_refund_pay>20210205111441</gmt_refund_pay>
  69. <member_id>1452</member_id>
  70. </balpay_res_info>
  71. <jfqpay_res_info>
  72. <trade_no>15415906</trade_no>
  73. <out_trade_no>1000000000511</out_trade_no>
  74. <refund_amount>1</refund_amount>
  75. <charge_amount>0</charge_amount>
  76. <gmt_refund_pay>20210205111441</gmt_refund_pay>
  77. </jfqpay_res_info>
  78. <result>
  79. <id>0000</id>
  80. <comment>成功</comment>
  81. </result>
  82. </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)平台优惠金额,单位为分可空
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
服务商公众号IDString(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
服务商公众号IDString(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
会员idString(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可空

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