业务说明

支持的交易类型:
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. "notify_url": "http://www.baidu.com/",
  15. "goods_detail": [
  16. {
  17. "goods_id": "apple-01",
  18. "payment_goods_id": "20010001",
  19. "goods_name": "ipad",
  20. "quantity": 1,
  21. "price": 200000,
  22. "goods_category": "34543238",
  23. "body": "特价手机",
  24. "show_url": "http://www.alipay.com/xxx.jpg"
  25. },
  26. {
  27. "goods_id": "apple-02",
  28. "payment_goods_id": "20010002",
  29. "goods_name": "ipad2",
  30. "quantity": 1,
  31. "price": 200000,
  32. "goods_category": "34543239",
  33. "body": "特价手机2",
  34. "show_url": "http://www.alipay.com/xxx2.jpg"
  35. }
  36. ],
  37. "extend_params": {
  38. "split_info": {
  39. "keep_amt": "800",
  40. "split_list": [
  41. {
  42. "merchant_id": "10000000000001",
  43. "div_amt": "150"
  44. },
  45. {
  46. "merchant_id": "10000000000002",
  47. "div_amt": "50"
  48. }
  49. ]
  50. }
  51. }
  52. },
  53. "sign": "E622B688C360F8444788740B111E4787"
  54. }

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. <notify_url><![CDATA[http://www.baidu.com/]]></notify_url>
  16. <goods_detail><![CDATA[商品信息(JSON)]]></goods_detail>
  17. <extend_params><![CDATA[扩展参数]]></extend_params>
  18. </barcode_reverse_request>
  19. </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_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": "",
  11. "buss_discount_amt": 0,
  12. "platform_discount_amt": 0,
  13. "fund_freeze_stat": "",
  14. "alipay_res_info": {
  15. "trade_no": "2018121422001429700548119225",
  16. "out_trade_no": "2018121400000001",
  17. "detail_error_code": "",
  18. "detail_error_desc": "",
  19. "send_back_fee": "1",
  20. "charge_amount": "0",
  21. "gmt_refund_pay": "20181214145333"
  22. },
  23. "wxpay_res_info": {
  24. "trade_no": "4200000196201812146252898537",
  25. "out_trade_no": "2018121400000002",
  26. "app_id": "wx5acb63e448b4fc22",
  27. "mch_id": "1241109502",
  28. "detail_error_code": "",
  29. "detail_error_desc": "",
  30. "send_back_fee": "1",
  31. "settlement_total_fee": "",
  32. "settlement_refund_fee": "",
  33. "charge_amount": "0",
  34. "gmt_refund_pay": "20181214150712"
  35. },
  36. "wxapp_res_info": {
  37. "trade_no": "4200000196201812146252898537",
  38. "out_trade_no": "2018121400000002",
  39. "app_id": "wx5acb63e448b4fc22",
  40. "mch_id": "1241109502",
  41. "detail_error_code": "",
  42. "detail_error_desc": "",
  43. "send_back_fee": "1",
  44. "settlement_total_fee": "",
  45. "settlement_refund_fee": "",
  46. "charge_amount": "0",
  47. "gmt_refund_pay": "20181214150712"
  48. },
  49. "upay_res_info": {
  50. "trade_no": "4200000196201812146252898537",
  51. "out_trade_no": "2018121400000002",
  52. "charge_amount": "0"
  53. },
  54. "ecny_res_info": {
  55. "trade_no": "4200000196201812146252898537",
  56. "out_trade_no": "2018121400000002",
  57. "refund_amount": "1",
  58. "do_refund_amount": "1",
  59. "charge_amount": "0",
  60. "gmt_refund_pay": "20210205111441",
  61. "detail_error_code": "",
  62. "detail_error_desc": ""
  63. },
  64. "balpay_res_info": {
  65. "trade_no": "4200000196201812146252898537",
  66. "out_trade_no": "2018121400000002",
  67. "refund_amount": "1",
  68. "charge_amount": "0",
  69. "gmt_refund_pay": "20210205111441",
  70. "member_id": "1452"
  71. },
  72. "jfqpay_res_info": {
  73. "trade_no": "4200000196201812146252898537",
  74. "out_trade_no": "2018121400000002",
  75. "refund_amount": "1",
  76. "charge_amount": "0",
  77. "gmt_refund_pay": "20210205111441"
  78. },
  79. "result": {
  80. "id": "0000",
  81. "comment": "交易成功"
  82. },
  83. "sign": "207482F2C0A998B73F388B8AA401DB76"
  84. }

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. <fund_freeze_stat></fund_freeze_stat>
  14. <alipay_res_info>
  15. <trade_no>2014110721001004640000791910</trade_no>
  16. <out_trade_no>2014110721001004640000791910</out_trade_no>
  17. <detail_error_code></detail_error_code>
  18. <detail_error_desc></detail_error_desc>
  19. <send_back_fee>1</send_back_fee>
  20. <charge_amount>0</charge_amount>
  21. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  22. </alipay_res_info>
  23. <wxpay_res_info>
  24. <trade_no>4200000196201812146252898537</trade_no>
  25. <out_trade_no>2014110721001004640000791910</out_trade_no>
  26. <app_id>2014110721001004640000791910</app_id>
  27. <mch_id>2014110721001004640000791910</mch_id>
  28. <detail_error_code></detail_error_code>
  29. <detail_error_desc></detail_error_desc>
  30. <send_back_fee>1</send_back_fee>
  31. <settlement_total_fee>1</settlement_total_fee>
  32. <settlement_refund_fee>1</settlement_refund_fee>
  33. <charge_amount>0</charge_amount>
  34. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  35. </wxpay_res_info>
  36. <wxapp_res_info>
  37. <trade_no>4200000196201812146252898537</trade_no>
  38. <out_trade_no>2014110721001004640000791910</out_trade_no>
  39. <app_id>2014110721001004640000791910</app_id>
  40. <mch_id>2014110721001004640000791910</mch_id>
  41. <detail_error_code></detail_error_code>
  42. <detail_error_desc></detail_error_desc>
  43. <send_back_fee>1</send_back_fee>
  44. <settlement_total_fee>1</settlement_total_fee>
  45. <settlement_refund_fee>1</settlement_refund_fee>
  46. <charge_amount>0</charge_amount>
  47. <gmt_refund_pay>20181115092624</gmt_refund_pay>
  48. </wxapp_res_info>
  49. <upay_res_info>
  50. <trade_no>15415906</trade_no>
  51. <out_trade_no>1000000000511</out_trade_no>
  52. <charge_amount>0</charge_amount>
  53. </upay_res_info>
  54. <ecny_res_info>
  55. <trade_no>15415906</trade_no>
  56. <out_trade_no>1000000000511</out_trade_no>
  57. <refund_amount>1</refund_amount>
  58. <do_refund_amount>1</do_refund_amount>
  59. <charge_amount>0</charge_amount>
  60. <gmt_refund_pay>20210205113225</gmt_refund_pay>
  61. <detail_error_code></detail_error_code>
  62. <detail_error_desc></detail_error_desc>
  63. </ecny_res_info>
  64. <balpay_res_info>
  65. <trade_no>15415906</trade_no>
  66. <out_trade_no>1000000000511</out_trade_no>
  67. <refund_amount>1</refund_amount>
  68. <charge_amount>0</charge_amount>
  69. <gmt_refund_pay>20210205111441</gmt_refund_pay>
  70. <member_id>1452</member_id>
  71. </balpay_res_info>
  72. <jfqpay_res_info>
  73. <trade_no>15415906</trade_no>
  74. <out_trade_no>1000000000511</out_trade_no>
  75. <refund_amount>1</refund_amount>
  76. <charge_amount>0</charge_amount>
  77. <gmt_refund_pay>20210205111441</gmt_refund_pay>
  78. </jfqpay_res_info>
  79. <result>
  80. <id>0000</id>
  81. <comment>成功</comment>
  82. </result>
  83. </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
服务商公众号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可空

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