1 Star 0 Fork 315

铜绿 / jeepay-sdk-java

forked from 计全科技 / jeepay-sdk-java 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

jeepay-sdk-java

接口文档

接口文档:https://docs.jeequan.com/docs/jeepay/payment_api

快速开始

引入sdk依赖(最新发布版本1.5.0),支持:支付、退款、转账、分账等接口。

  <dependency>
      <groupId>com.jeequan</groupId>
      <artifactId>jeepay-sdk-java</artifactId>
      <version>1.5.0</version>
  </dependency>

客户端调用代码可参考:

完整支付测试代码 com.jeequan.jeepay.PayOrderTest

    // 创建客户端
    JeepayClient jeepayClient = JeepayClient.getInstance(Jeepay.appId, Jeepay.apiKey);

    // 构建请求数据
    String wayCode = "WX_BAR";                           // 支付方式
    PayOrderCreateRequest request = new PayOrderCreateRequest();
    PayOrderCreateReqModel model = new PayOrderCreateReqModel();
    model.setMchNo(Jeepay.mchNo);                       // 商户号
    model.setAppId(jeepayClient.getAppId());            // 应用ID
    String orderNo = "mho" + new Date().getTime();
    model.setMchOrderNo(orderNo);                       // 商户订单号
    model.setWayCode(wayCode);                          // 支付方式
    model.setAmount(1l);                                // 金额,单位分
    model.setCurrency("CNY");                           // 币种,目前只支持cny
    model.setClientIp("192.166.1.132");                 // 发起支付请求客户端的IP地址
    model.setSubject("商品标题");                         // 商品标题
    model.setBody("商品描述");                            // 商品描述
    model.setNotifyUrl("https://www.jeequan.com");      // 异步通知地址
    model.setReturnUrl("");                             // 前端跳转地址
    model.setChannelExtra(channelExtra(wayCode));       // 渠道扩展参数
    model.setExtParam("");                              // 商户扩展参数,回调时原样返回
    request.setBizModel(model);
    
    // 发起统一下单
    PayOrderCreateResponse response = jeepayClient.execute(request);

    // 验证返回数据签名
    response.checkSign(Jeepay.apiKey);

    // 判断下单是否返回成功
    response.isSuccess(Jeepay.apiKey)

完整退款测试代码 com.jeequan.jeepay.RefundOrderTest

    // 创建客户端
    JeepayClient jeepayClient = JeepayClient.getInstance(Jeepay.appId, Jeepay.apiKey);

    // 构建请求数据
    RefundOrderCreateRequest request = new RefundOrderCreateRequest();
    RefundOrderCreateReqModel model = new RefundOrderCreateReqModel();
    model.setMchNo(Jeepay.mchNo);                       // 商户号
    model.setAppId(Jeepay.appId);                       // 应用ID
    model.setMchOrderNo("");                            // 商户支付单号(与支付订单号二者传一)
    model.setPayOrderId("P202106181104177050002");      // 支付订单号(与商户支付单号二者传一)
    String refundOrderNo = "mho" + new Date().getTime();
    model.setMchRefundNo(refundOrderNo);                // 商户退款单号
    model.setRefundAmount(4l);                          // 退款金额,单位分
    model.setCurrency("cny");                           // 币种,目前只支持cny
    model.setClientIp("192.166.1.132");                 // 发起支付请求客户端的 IP 地址,格式为 IPV4,如: 127.0.0.1
    model.setRefundReason("退款测试");                    // 退款原因
    model.setNotifyUrl("https://www.jeequan.com");      // 异步通知地址
    model.setChannelExtra("");                          // 渠道扩展参数
    model.setExtParam("");                              // 商户扩展参数,回调时原样返回
    request.setBizModel(model);
    
    // 发起统一退款
    RefundOrderCreateResponse response = jeepayClient.execute(request);

    // 验证返回数据签名
    response.checkSign(Jeepay.apiKey);

    // 判断退款发起是否成功(并不代表退款成功)退款状态 0-订单生成 1-退款中 2-退款成功 3-退款失败 4-退款关闭
    // 如果 response.get().getState()==2 表示退款成功
    response.isSuccess(Jeepay.apiKey)

完整转账测试代码 com.jeequan.jeepay.TransferOrderTest

    // 创建客户端
    JeepayClient jeepayClient = JeepayClient.getInstance(Jeepay.appId, Jeepay.apiKey);
    TransferOrderCreateRequest request = new TransferOrderCreateRequest();
    TransferOrderCreateReqModel model = new TransferOrderCreateReqModel();
    model.setMchNo(Jeepay.mchNo);                           // 商户号
    model.setAppId(Jeepay.appId);                           // 应用ID
    model.setMchOrderNo("mho" + new Date().getTime());      // 商户转账单号
    model.setAmount(1L);
    model.setCurrency("CNY");
    model.setIfCode("wxpay");
    model.setEntryType("WX_CASH");
    model.setAccountNo("a6BcIwtTvIqv1zXZohc61biryWok");
    model.setAccountName("");
    model.setTransferDesc("测试转账");
    model.setClientIp("192.166.1.132");                     // 发起转账请求客户端的IP地址
    request.setBizModel(model);
    try {
        TransferOrderCreateResponse response = jeepayClient.execute(request);
        _log.info("验签结果:{}", response.checkSign(Jeepay.apiKey));
        // 判断转账发起是否成功(并不代表转账成功)
        if(response.isSuccess(Jeepay.apiKey)) {
            String transferId = response.get().getTransferId();
            _log.info("transferId:{}", transferId);
            _log.info("mchOrderNo:{}", response.get().getMchOrderNo());
        }else {
            _log.info("下单失败:mchOrderNo={}, msg={}", model.getMchOrderNo(), response.getMsg());
            _log.info("通道错误码:{}", response.get().getErrCode());
            _log.info("通道错误信息:{}", response.get().getErrMsg());
        }
    } catch (JeepayException e) {
        _log.error(e.getMessage());
    }

其他相关

Jeepay是一套适合互联网企业使用的开源支付系统,支持多渠道服务商和普通商户模式。已对接微信支付支付宝云闪付官方接口,支持聚合码支付。

Jeepay使用Spring BootAnt Design Vue开发,集成Spring Security实现权限管理功能,是一套非常实用的web开发框架。

Jeepay项目地址:https://gitee.com/jeequan

MIT License Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Jeepay对应的java客户端实现 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/greenpatina/jeepay-sdk-java.git
git@gitee.com:greenpatina/jeepay-sdk-java.git
greenpatina
jeepay-sdk-java
jeepay-sdk-java
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891