• 支付服务

    服务简码 HPAY

    默认端口 8250

    组件编码 hzero-pay

    简介

    1.1 概述

    HZERO支付平台,对接了支付宝、微信、银联的支付方式,同时提供额外的支付订单管理与退款订单管理。

    1.2 组件坐标

    <dependency>
        <groupId>org.hzero</groupId>
        <artifactId>hzero-pay</artifactId>
        <version>${hzero.service.version}</version>
    </dependency>
    

    1.3 主要功能

    1.4 服务配置参数

    # 回调地址根路径  例:http://gateway:8080/hpay/v1/
    hzero.pay.callback
    

    开发指导

    2.1 支付宝支付相关

    报文示例:

    {
      "paymentAmount": "0.01",                              支付金额
      "currencyCode": "CNY",                                币种
      "paymentCustomer": "12345",                           支付客户
      "paymentSubject": "测试订单",                         商品名称/交易标题/订单标题/订单关键字等
      "paymentDescription": "测试商品",                     商品名称/交易标题/订单标题/订单描述等
      "returnUrl":"http://hzerodevf.saas.hand-china.com",   支付完成后返回的页面,若不指定使用支付配置定义的回调地址
      "merchantOrderNum": "21781782",                       商户支付订单号,单号相同不会创建新订单
      "channelTrxType": "PC",                               渠道事务类型  PC(网页支付)WAP(手机网站支付)APP(APP支付)BAR(条码支付)
      "expireTime":"2019-06-20 10:10:10"                    到期时间
    }
    

    响应示例:

    {
        "code": "success",
        "data": "<form id=\"_alipaysubmit_\" name=\"alipaysubmit\" action=\"https://openapi.alipay.com/gateway.do?app_id=2018110561993668&charset=UTF-8&format=json&method=alipay.trade.page.pay&notify_url=http%3A%2F%2Fhzeronb.saas.hand-china.com%2Fhpay%2Fv1%2F0%2Falipay%2FALIPAY%2Fcallback&return_url=http%3A%2F%2Fhzeronf.saas.hand-china.com&sign=k82GOoztI6SczR8y9JtgQa0ipSCoxqyR%2BMQYgfOMd9wuICViOHj2OfOJ1HgJy1Uz%2F2Qmu8F%2FLsjs4oOr7sIoEhQCW%2FpM4ZVeesS2VBsinEM9l8JSuRNvGPwrUyVHTr2UnrfUr7VeqiOgIQ1vNRG%2F06n%2FeBqMWywRR9XmFz9XCCQrZdT0qEe%2FQT6gJGN8%2BmcZgXifX5LjxJofxupVZ9I%2FZzRMvZOaxw5CB2UAO7w5Q2i%2BbPFbIan1wra%2FeudzTl0klp23FcPTWD6Dt0uNv9s0mV4J%2BZ2QIPS5q9LsLiPZESZeHmWWHJ8CyLNJaFZdQzOQkkxcW81P2AqNpMbMDC%2FJBQ%3D%3D&sign_type=RSA2&timestamp=2019-07-24+11%3A34%3A37&version=1.0\" method=\"post\"><input type=\"hidden\" name=\"biz_content\" value='{\"body\":\"测试商品\",\"out_trade_no\":\"21781783\",\"product_code\":\"FAST_INSTANT_TRADE_PAY\",\"subject\":\"测试订单\",\"total_amount\":\"0.01\"}'/></form><script>document.forms['_alipaysubmit_'].submit();</script>"
    }
    

    前端根据data中的标签渲染即可得到支付页面

    报文示例:

    {
      "paymentAmount": "0.01",
      "currencyCode": "CNY",
      "paymentCustomer": "12345",
      "paymentSubject": "支付测试订单",
      "returnUrl":"http://hzerodevf.saas.hand-china.com",
      "merchantOrderNum": "21781782",
      "paymentDescription": "测试支付"
    }
    

    报文示例:

    {
      "paymentAmount": "0.01",
      "currencyCode": "CNY",
      "paymentCustomer": "12345",
      "paymentSubject": "支付测试订单",
      "returnUrl":"http://hzerodevf.saas.hand-china.com",
      "merchantOrderNum": "21781782",
      "paymentDescription": "测试支付"
    }
    

    报文示例:

    {
      "outTradeNo": "21781782"                      商户支付订单号
    }
    

    报文示例:

    {
      "outTradeNo": "21781782 ",                    商户支付订单号
      "tradeNo": "2019061222001478271043735658"     支付流水号
    }
    

    报文示例:

    {
      "outTradeNo": "21781782",                     商家支付订单号
      "refundAmount": 0.01                          退款金额
    }
    

    报文示例:

    {
      "outTradeNo": "21781782",                     商家支付订单号
      "tradeNo": "2019061222001478271043735658",    支付流水号
      "refundAmount": 0.01,                         退款金额
      "refundNo": "R02019061319094520800"           退款订单号
    }
    

    报文示例:

    {
    "billDate":"2019-06-18 13:56:01",               账单时间:具体请查看对应支付平台
    "billType":"trade"                              账单类型:具体请查看对应支付平台
    }
    

    平台记录的订单数据也可用于对账,但不保证数据的绝对准确!!

    2.2 微信支付与银联支付

    接口调用与支付宝相似

    声明:银联支付没有经过充分测试

    2.3 通用支付

    可以通过channelCode动态指定支付方式, alipay支付宝 wxpay微信 unionpay银联

    展望