{"id":37070247,"url":"https://github.com/adisonhuang/pay-python","last_synced_at":"2026-01-14T08:11:41.396Z","repository":{"id":57409825,"uuid":"166222903","full_name":"adisonhuang/pay-python","owner":"adisonhuang","description":" 轻量级支付方式整合集成，实现支付与业务完全剥离，快速简单完成支付模块的开发，代码实现优雅灵活，横向扩展简单","archived":false,"fork":false,"pushed_at":"2024-05-21T07:21:47.000Z","size":29,"stargazers_count":139,"open_issues_count":4,"forks_count":38,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-16T22:47:56.747Z","etag":null,"topics":["alipay","pay","python","wechat-pay","wechatpay"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adisonhuang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-01-17T12:34:08.000Z","updated_at":"2025-07-14T08:20:45.000Z","dependencies_parsed_at":"2024-01-16T03:41:14.111Z","dependency_job_id":"2044e99f-6c98-48f2-954d-d31e808f8011","html_url":"https://github.com/adisonhuang/pay-python","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"bc1b926cd5e6d42fcd945b6c7dc9c3c003aab571"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/adisonhuang/pay-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adisonhuang%2Fpay-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adisonhuang%2Fpay-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adisonhuang%2Fpay-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adisonhuang%2Fpay-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adisonhuang","download_url":"https://codeload.github.com/adisonhuang/pay-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adisonhuang%2Fpay-python/sbom","scorecard":{"id":166585,"data":{"date":"2025-08-11","repo":{"name":"github.com/adisonhuang/pay-python","commit":"aed88382b1be228a3755cb3d071ee2c606d02209"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j225-cvw7-qrx7","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T15:05:04.962Z","repository_id":57409825,"created_at":"2025-08-16T15:05:04.963Z","updated_at":"2025-08-16T15:05:04.963Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["alipay","pay","python","wechat-pay","wechatpay"],"created_at":"2026-01-14T08:11:40.873Z","updated_at":"2026-01-14T08:11:41.382Z","avatar_url":"https://github.com/adisonhuang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python 支付整合开发包\n\n轻量级支付方式整合集成，实现支付与业务完全剥离，快速简单完成支付模块的开发\n\n## 特性\n\n1. 屏蔽支付方式之间接入API和数据结构的差异，统一API和数据结构\n2. 支持支付类型横向扩展\n3. 统一异常处理\n\n## 支持支付方式及功能\n### 支付方式\n* 支付宝(`pay_type=ali_pay`)\n* 微信支付(`pay_type=wx_pay`)\n\n### 通用功能\n* [电脑网站支付](#trade_page_pay)\n* [手机网站支付](#trade_wap_pay)\n* [APP支付](#trade_app_pay)\n* [异步通知校验](#parse_and_verify_result)\n* [交易查询](#trade_query)\n* [交易取消](#trade_cancel)\n* [退款](#trade_refund)\n* [退款查询](#trade_refund_query)\n\n### 平台特有功能\n* [微信JS支付](#trade_js_pay)\n* [微信企业付款到零钱](#enterprise_pay)\n\n## 使用说明\n### 安装\n```python\n# installation\npip install all-pay --upgrade\n```\n\n### 核心说明\n\n#### 配置(dict)\n\n```shell\nALIPAY_CONFIG = {\n    'pay_type': 'ali_pay', # 必填 区分支付类型\n    'app_id': 'xxx', #必填 应用id\n    'private_key_path': 'xxx', #必填 私钥\n    'public_key_path': 'xxx',#必填 公钥\n    'notify_url': 'xxx',# 异步回调地址\n    'sign_type': 'RSA2',  # 签名算法 RSA 或者 RSA2\n    'debug': False, # 是否是沙箱模式\n}\n\nWECHAT_CONFIG = {\n    'pay_type': 'wx_pay', # 必填 区分支付类型\n    'app_id': 'xxx',  # 必填,应用id\n    'mch_key': 'xxx',  # 必填,商户平台密钥\n    'mch_id': 'xxx',  # 必填,微信支付分配的商户号\n    'app_secret': 'xxx', # 应用密钥\n    'notify_url': 'xxx'# 异步回调地址\n    'api_cert_path': 'xxx', # API证书\n    'api_key_path': 'xxx' # API证书 key\n}\n```\n\n其中 `pay_type`为本项目所需，用来区分支付类型，其余为对应支付方式所需配置参数，具体参考对应支付方式对应的官方文档。\n\n\n#### [Pay类](https://github.com/adisonhuang/pay-python/blob/master/all_pay/pay.py)\n\n\n**支付网关，支付方式分配和转发入口**\n\n#### [PayOrder类](https://github.com/adisonhuang/pay-python/blob/master/all_pay/pay_order.py)\n\n**统一封装支付订单信息，主要用于支付下单**\n\n生成统一订单例子\n\n```python\norder = PayOrder.Builder().subject('商品标题') .out_trade_no('商品订单号').total_fee('商品费用').build()\n```\n通过`Builder模式+链式调用`灵活组合通用参数和特殊参数\n更多参数说明参见[源码](https://github.com/adisonhuang/pay-python/blob/master/all_pay/pay_order.py)\n\n#### [PayResponse类](https://github.com/adisonhuang/pay-python/blob/master/all_pay/pay_response.py)\n\n**统一封装支付返回业务信息，主要用于支付查询**\n\n生成统一回单例子\n\n```python\nresponse = PayResponse.Builder().trade_no('平台订单号').out_trade_no('商家订单号').build()\n```\n\n通过`Builder模式+链式调用`灵活组合通用参数和特殊参数\n更多参数说明参见[源码](https://github.com/adisonhuang/pay-python/blob/master/all_pay/pay_response.py)\n\n### demo\n\n```python\nfrom all_pay import PayOrder\nfrom all_pay import Pay\nALIPAY_CONFIG = {\n    'pay_type': 'ali_pay', # 必填 区分支付类型\n    'app_id': 'xxx', #必填 应用id\n    'private_key_path': 'xxx', #必填 私钥\n    'public_key_path': 'xxx',#必填 公钥\n    'notify_url': 'xxx',# 异步回调地址\n    'sign_type': 'RSA2',  # 签名算法 RSA 或者 RSA2\n    'debug': False, # 是否是沙箱模式\n}\n# 额外参数，某些支付方式有些选填的参数在PayOrder并没有封装，可以自行传递\nextra_params= {\n    'xxx':'xxx'\n    'xxx':'xxx'\n    'xxx':'xxx'\n}\norder = PayOrder.Builder().subject('商品标题') .out_trade_no('商品订单号').total_fee('商品费用').build()\npay = Pay(ALIPAY_CONFIG) # 传入对应支付方式配置\norder_res= pay.trade_page_pay(order,extra_params)# 传入对应订单和额外参数（要是需要）\n```\n\n### 功能说明\n\n#### \u003ca name=\"trade_page_pay\"\u003e电脑网站支付[trade_page_pay]\u003c/a\u003e\n\n```python\npay = Pay(ALIPAY_CONFIG) # 传入对应支付方式配置\norder_res= pay.trade_page_pay(order)# 传入对应订单\n```\n\n#### \u003ca name=\"trade_wap_pay\"\u003e手机网站支付[trade_wap_pay]\u003c/a\u003e\n\n```python\npay = Pay(ALIPAY_CONFIG) # 传入对应支付方式配置\norder_res= pay.trade_wap_pay(order)# 传入对应订单\n```\n\n#### \u003ca name=\"trade_app_pay\"\u003eAPP支付[trade_app_pay]\u003c/a\u003e\n\n```python\npay = Pay(ALIPAY_CONFIG) # 传入对应支付方式配置\norder_res= pay.trade_app_pay(order)# 传入对应订单\n```\n\n#### \u003ca name=\"parse_and_verify_result\"\u003e异步通知校验[parse_and_verify_result]\u003c/a\u003e\n\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应支付方式返回的原始数据，校验成功会返回解析成json数据\ndata = pay.parse_and_verify_result(req_xml)\n```\n\n\n#### \u003ca name=\"trade_js_pay\"\u003e微信JS支付[trade_js_pay]\u003c/a\u003e\n\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应订单\ndata = pay.trade_js_pay(order)\n```\n\n#### \u003ca name=\"enterprise_pay\"\u003e微信企业付款到零钱[enterprise_pay]\u003c/a\u003e\n\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应订单\ndata = pay.enterprise_pay(order)\n```\n\n#### \u003ca name=\"trade_query\"\u003e交易查询[trade_query]\u003c/a\u003e\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应回单信息\ndata = pay.trade_query(response)\n```\n\n#### \u003ca name=\"trade_cancel\"\u003e交易取消[trade_cancel]\u003c/a\u003e\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应回单信息\ndata = pay.trade_cancel(response)\n```\n#### \u003ca name=\"trade_refund\"\u003e退款[trade_refund]\u003c/a\u003e\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应回单信息\ndata = pay.trade_refund(response)\n```\n#### \u003ca name=\"trade_refund_query\"\u003e退款查询[trade_refund_query]\u003c/a\u003e\n```python\n# 传入对应支付方式配置\npay = Pay(WECHAT_CONFIG)\n# 传入对应回单信息\ndata = pay.trade_refund_query(response)\n```\n\n## 贡献\n\n本项目目前支持的支付方式和API还不多，欢迎你给本项目提pull request，扩展新的的支付接口，同时如果你有好的意见或建议，也欢迎给本项目提issue\n\n## 声明：\n\n本项目在具体支付模块的接入实现参考了一些开源项目\n\n[python-alipay-sdk](https://github.com/fzlee/alipay)\n\n[wx_pay_python](https://github.com/Jolly23/wx_pay_python)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadisonhuang%2Fpay-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadisonhuang%2Fpay-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadisonhuang%2Fpay-python/lists"}