{"id":38742858,"url":"https://github.com/deific/supay","last_synced_at":"2026-01-17T11:41:52.741Z","repository":{"id":37120403,"uuid":"264207537","full_name":"deific/supay","owner":"deific","description":"极简（super）支付系统","archived":false,"fork":false,"pushed_at":"2025-06-29T03:23:36.000Z","size":1550,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-29T04:26:29.408Z","etag":null,"topics":["pay","payment"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deific.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-15T13:57:28.000Z","updated_at":"2025-06-29T03:23:35.000Z","dependencies_parsed_at":"2024-08-22T02:46:12.819Z","dependency_job_id":"e1080e88-605e-4843-a2dd-4331d4ed6567","html_url":"https://github.com/deific/supay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deific/supay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deific%2Fsupay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deific%2Fsupay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deific%2Fsupay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deific%2Fsupay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deific","download_url":"https://codeload.github.com/deific/supay/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deific%2Fsupay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pay","payment"],"created_at":"2026-01-17T11:41:52.002Z","updated_at":"2026-01-17T11:41:52.729Z","avatar_url":"https://github.com/deific.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# supay\n### [极简（super）支付系统](https://gitee.com/orangesoft/supay)\n\n极简(super)支付系统，抽象统一简化接口，轻量级可扩展的支付SDK封装，支持微信、支付宝等主流应用，让支付接入更简洁。提供了优雅架构设计的支付工具包和完善的支付系统。\n\n[![star](https://gitee.com/geekgarden/supay/badge/star.svg?theme=white)](https://gitee.com/geekgarden/supay/stargazers)\n[![fork](https://gitee.com/geekgarden/supay/badge/fork.svg?theme=white)](https://gitee.com/geekgarden/supay/members)\n\nGitee：[https://gitee.com/geekgarden/supay](https://gitee.com/geekgarden/supay)\n\nGitHub：[https://github.com/deific/supay](https://github.com/deific/supay)\n\n\n欢迎 Star，欢迎 PR！\n\n## 特性\n\n- 极少依赖,结构清晰，轻量级可扩展的工具包SDK,可嵌入任何系统\n- 统一支付入口和方法,命名简化清晰,简化调用,隐藏开发者不需要关注的细节\n- 高度抽象接口和出入参数数据bean，免去各种拼装和解析json与xml的痛苦\n- 支持多商户多应用，随心切换\n- 支持调用过滤器机制,可以灵活扩展调用逻辑,第三方接口灵活切换使用\n- Context支付上下文设计,可以灵活控制和监控每一笔支付交易\n\n## 运行环境\nJDK1.8\n\n## 安装\n### maven仓库安装\n暂未发布上传到maven中央仓库，请先git clone到本地安装测试！\n  \n## 支持方法\n请先熟悉支付宝/微信支付流程和机制，请具有基本的 debug 能力，本质上我们还是调用的是它们的接口！！！！\n\n| 方法        | 说明         | 微信 | 支付宝 |\n| :---------- | :----------- | :--- | :----- |\n| web         | 电脑支付     | 无   | 支持   |\n| wap/H5      | 手机网站支付 | 支持 | 支持   |\n| app         | APP 支付     | 支持 | 支持   |\n| face        | 刷卡支付     | 支持 | 支持   |\n| scan        | 扫码支付     | 支持 | 支持   |\n| mini        | 小程序支付   | 支持 | 支持   |\n| mp          | 公众号支付   | 支持 | 无     |\n| refund      | 退款         | 支持 | 支持   |\n| query       | 支付查询     | 支持 | 支持   |\n| refundQuery | 退款查询     | 支持 | 支持   |\n| notify      | 通知        | 支持 | 支持   |\n\n\n## 痛点\n调用第三方支付系统通常在自身业务中中经常遇到，支付流程总的来说大差不多，但各大第三方支付系统，银行的支付接口各自不一样：\n- 接口签名方法不一样\n   ```java\n    例如:微信和支付宝的接口签名算法不一样,有的还需要有证书,有的不需要\n   ``` \n- 参数要求不一样，传输格式不一样\n    ```java\n        例如:同样一笔支付请求,微信和支付的支付参数要求不一样,简单点的可以几个参数,复杂的几十个参数.微信用xml传输,支付宝用json等\n    ``` \n- 接口交互方式不一样\n    ```java\n        例如:有的接口是直接返回交易结果数据,有的接口实际返回html片段,需要在浏览器再次提交\n    ``` \n\n这些不一样的地方造成开发人员在对接支付系统时，不得不去详细了解各个第三方支付系统自身的实现机制，还需要考虑自身业务在使用不同渠道时如何设计路由等。\n更过情况下，可能会在不同项目中复制粘贴代码的方式去复用代码，容易出错，而且对于其他人员接手又需要了解支付的机制。\n\n## 设计\n基于上述痛点的考虑，supay的力图在一个统一层面消除不同支付系统接口的不一致性，对于业务暴露出统一的支付交互接口和交互流程，降低业务系统方使用支付的\n难度，统一成一套流程，并且提供扩展性。\n- 抽象和统一支付交易流程，屏蔽支付系统差异\n- 内部架构设计支付扩展第三方支付系统\n\n**设计思路请参考 [wiki](https://gitee.com/geekgarden/supay/wikis/supay%20%E6%9E%81%E7%AE%80%E6%94%AF%E4%BB%98) 设计文档**\n\n工具包可单独使用，通过整合、抽象、聚合第三方支付系统接口，对外提供简洁的使用和调用接口完成第三方支付接口（微信,支付宝,银联等等）调用，实现了扫码支付、H5支付、小程序支付等，支付与业务完全剥离，简单几行代码即可实现支付，简单快速完成支付模块的开发，可轻松嵌入到任何系统里。并且采用灵活的扩展性架构，以便实现更多的第三方支付接口。\n支付系统完善的支付系统。包括商户管理，用户账户体系，支付管理，支付路由，订单管理，上下游对账，清结算等支付核心功能，目标是打造一个开源的完善的可扩展的用于生产的支付系统。\n\n**supay思维导图**\n![支付](/docs/SupayCore.png)\n\n## 示例\u0026效果\n**简单Demo**\n简单的支付demo，使用配置文件配置相关支付参数，直接执行main函数运行\n\nGitee：[supay-simaple-demo](https://gitee.com/geekgarden/supay/tree/master/supay-demo/supay-simaple-demo) \n\nGitHub： [supay-simaple-demo](https://github.com/deific/supay/tree/master/supay-demo/supay-simaple-demo)\n\n**springboot版本 Demo**\n基于springboot体系搭建的demo,通过api接口调用处方\n\nGitee：[supay-boot-demo](https://gitee.com/geekgarden/supay/tree/master/supay-demo/supay-boot-demo) \n\nGitHub： [supay-boot-demo](https://github.com/deific/supay/tree/master/supay-demo/supay-boot-demo)\n\n### 普通用法\n```java\n    String orderCode = IdUtil.fastSimpleUUID();\n    \n    // 阿里支付调用\n\n    // 构建支付上下文\n    SupayContext cxt = AliPayPageRequest.builder()\n            .outTradeNo(orderCode)\n            .payType(SupayPayType.ALI_PAGE_PAY)\n            .subject(\"测试网页支付\")\n            .totalAmount(\"1\")\n            .returnUrl(\"http://taobao.com\")\n            .build().toContext(channelConfig.getAppId(), false);\n\n    // 本地模拟支付\n    cxt.setLocalMock(true);\n    // 调用支付接口\n    cxt = (SupayContext) SupayCore.pay(cxt);\n    \n    log.debug(\"交易状态：{} 信息：{} 耗时：{}ms 接口响应数据：{}\", cxt.hasError(),\n            cxt.getMsg(), cxt.duration(), JSONUtil.toJsonStr(cxt.getResponse()));\n\n\n    // 微信支付调用\n    // 构建支付上下文\n    SupayContext cxt = WxPayUnifiedOrderRequest.builder()\n            .body(\"测试微信支付订单\")\n            .outTradeNo(orderCode)\n            .productId(\"12\")\n            .notifyUrl(\"https://www.spay.org.cn/notify\")\n            .totalFee(\"100\")\n            .timeStart(DateUtil.format(new Date(), \"yyyyMMddHHmmss\"))\n            .timeExpire(DateUtil.format(DateUtil.offsetMinute(new Date(), 15), \"yyyyMMddHHmmss\"))\n            .tradeType(SupayPayType.WX_MP_PAY.getCode())\n            .openid(props.getStr(\"wx.openId\"))\n            .spbillCreateIp(\"127.0.0.1\")\n            .nonceStr(String.valueOf(System.currentTimeMillis()))\n            .build().toContext(channelConfig.getAppId(), false);\n\n    // 调用支付接口\n    cxt = (SupayContext) SupayCore.pay(cxt);\n    if (!cxt.hasError()) {\n        cxt.getResponse();\n    }\n    log.debug(\"交易状态：{} 信息：{} 耗时：{}ms 接口响应数据：{}\", cxt.hasError(), cxt.getMsg(), cxt.duration(), cxt.getResponse());\n\n    // 查询支付订单\n    WxPayOrderQueryRequest qReq = WxPayOrderQueryRequest.builder().outTradeNo(orderCode).build();\n    SupayContext qCtx = SupayContext.buildContext(channelConfig, qReq, false);\n\n\n//        SupayCore.queryPayOrder(qCtx);\n    // 获取具体渠道支付服务\n    ChannelPayService wxPayChannelService = SupayCore.getPayChannelService(SupayChannelType.WECHAT);\n    wxPayChannelService.queryTradeInfo(qCtx);\n\n    log.debug(\"查询结果：{}\", qCtx.getResponse());\n```\n\n### 简洁用法\n在大多数支付业务场景中，使用到的只有支付、退款、查询等几个高频业务接口，多数情况下也只要需要知道和传输几个必要的参数，所有针对高频接口我们又做了更简洁静态方法封装，调用更明确清晰，参数更简洁。\n特性：\n- 统一Supay核心入口\n- 明确的静态方法\n- 必要简洁的业务参数\n- 几行代码完成\n- 过滤器机制，全程可监控扩展\n```java\n\n    // 扫码支付，根据appId的配置自动识别微信，支付宝\n    String orderCode = IdUtil.fastSimpleUUID();\n    String qrCodeUrl = Supay.scanPay(channelConfig.getAppId(), \"测试支付\", orderCode, new BigDecimal(0.01), \"https://www.spay.org.cn/notify\");\n    log.debug(\"二维码支付内容：{}\", qrCodeUrl);\n\n    // app支付\n    String orderCode = IdUtil.fastSimpleUUID();\n    String appParamJson = Supay.appPay(channelConfig.getAppId(), \"测试支付\", orderCode, new BigDecimal(0.01), \"https://www.spay.org.cn/notify\");\n    log.debug(\"app支付内容：{}\", appParamJson);\n\n    // 退款\n    String orderCode = IdUtil.fastSimpleUUID();\n    String refundCode = IdUtil.fastSimpleUUID();\n    Supay.refund(channelConfig.getAppId(), orderCode, refundCode, new BigDecimal(0.01), new BigDecimal(0.01), \"https://www.spay.org.cn/notify\");\n```\n\n## 统一支付入口Supay\n抽象各个第三方渠道支付接口和调用过程，统一支付SupayCore提供入口，对于不同的第三方渠道支付，Supay的方法入参和返回值不同。并且调用过程中增加了过滤器设计，可以灵活扩展各渠道调用过程。\n\n## 进度\u0026计划\n开发中\n\n### 贡献代码\n最后如果该库对你有帮助，不妨右上角点点 Star或者任意赞助支持，我更喜欢你 Fork PR 成为项目贡献者 .\n\n## 支付官方文档 \n主要的第三方支付接口文档。\n\n- [微信委托扣款 API-服务商模式](https://pay.weixin.qq.com/wiki/doc/api/pap_sl.php?chapter=17_1)\n- [微信委托扣款 API-普通商户模式](https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=17_1)\n- [支付宝开发平台](https://docs.open.alipay.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeific%2Fsupay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeific%2Fsupay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeific%2Fsupay/lists"}