{"id":19022009,"url":"https://github.com/smartwalle/unionpay","last_synced_at":"2025-04-23T08:12:23.505Z","repository":{"id":170828506,"uuid":"645580031","full_name":"smartwalle/unionpay","owner":"smartwalle","description":"银联支付 unionpay SDK for Go, 当前支持版本 5.1.0。","archived":false,"fork":false,"pushed_at":"2023-10-17T09:02:42.000Z","size":59,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T08:12:17.527Z","etag":null,"topics":["95516","go","golang","pay","unionpay"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartwalle.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":"2023-05-26T01:22:21.000Z","updated_at":"2025-03-23T19:31:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"a570dd8d-7d3a-412c-b5e0-6752c2eed992","html_url":"https://github.com/smartwalle/unionpay","commit_stats":null,"previous_names":["smartwalle/unionpay"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartwalle%2Funionpay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartwalle%2Funionpay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartwalle%2Funionpay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartwalle%2Funionpay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartwalle","download_url":"https://codeload.github.com/smartwalle/unionpay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395288,"owners_count":21423400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["95516","go","golang","pay","unionpay"],"created_at":"2024-11-08T20:24:32.173Z","updated_at":"2025-04-23T08:12:23.486Z","avatar_url":"https://github.com/smartwalle.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"银联支付\n\n## 鸣谢\n\n[![jetbrains.svg](jetbrains.svg)](https://www.jetbrains.com/?from=AliPay%20SDK%20for%20Go)\n\n## 帮助\n\n在集成的过程中有遇到问题，欢迎加 QQ 群 203357977 讨论。\n\n## 安装\n\n```go\ngo get github.com/smartwalle/unionpay\n```\n\n```go\nimport github.com/smartwalle/unionpay\n```\n\n#### 关于错误 x509: certificate signed by unknown authority (possibly because of \"x509: cannot verify signature: insecure algorithm SHA1-RSA (temporarily override with GODEBUG=x509sha1=1)\" while trying to verify candidate authority certificate \"CFCA TEST OCA1\")\n\n由于安全问题，从 Go 1.18 开始，其 crypto/x509 包默认将拒绝使用 SHA-1 哈希函数签名的证书(自签发的除外)。\n\n银联测试环境签发的证书目前使用的是 SHA-1 签名（没有生产环境，无法得知生产环境信息是否也是使用 SHA-1 进行签名）。\n\n#### 解决办法\n可以通过设置 GODEBUG=x509sha1=1 环境变量暂时恢复。\n\n```shell\nGODEBUG=x509sha1=1 go run main.go \n```\n\n## 其它支付\n\n支付宝 [https://github.com/smartwalle/alipay](https://github.com/smartwalle/alipay)\n\n苹果支付 [https://github.com/smartwalle/apple](https://github.com/smartwalle/apple)\n\nPayPal [https://github.com/smartwalle/paypal](https://github.com/smartwalle/paypal)\n\n## 测试环境\n\n可从 [https://open.unionpay.com/tjweb/ij/user/mchTest/param](https://open.unionpay.com/tjweb/ij/user/mchTest/param) 获取测试环境信息。\n\n## 示例\n\n[https://github.com/smartwalle/unionpay/tree/master/examples](https://github.com/smartwalle/unionpay/tree/master/examples) 包含一个完整示例。\n\n运行该示例代码之后，可以在浏览器中访问 [http://127.0.0.1:9988/unionpay](http://127.0.0.1:9988/unionpay) 以打开测试页面。\n\n## 已实现接口\n\n* 消费接口-创建网页支付 - CreateWebPayment()\n* 消费接口-创建 App 支付 - CreateAppPayment()\n* 交易状态查询接口 - GetTransaction()\n* 消费撤销接口 - Revoke()\n* 退货接口接口 - Refund()\n\n## 关于交易状态\n\n在银联系统中，发起消费(支付)、消费撤销(退款)和退货(退款)都会产生交易，都可以通过[交易状态查询接口](https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=757\u0026apiservId=448\u0026version=V2.2\u0026bussType=0)查询相关信息。\n\n**退款状态不会在原支付交易中体现。**\n\n## 重要资料\n\n* [如何判断交易成功？怎么确定交易成功？](https://open.unionpay.com/tjweb/support/faq/mchlist?id=116)\n* [应答码及交易状态查询机制\n  ](https://open.unionpay.com/tjweb/support/faq/mchlist?id=234)\n* [交易状态查询交易，应答的respCode和origRespCode有什么区别？](https://open.unionpay.com/tjweb/support/faq/mchlist?id=610)\n* [消费撤销/退货成功了，查询接口能查到它们的状态吗？如何查询退款交易？有统一交易查询接口么？\n  ](https://open.unionpay.com/tjweb/support/faq/mchlist?id=79)\n* [接收通知后我们需要返什么应答？接收异步通知后需要返什么给银联？异步通知需要返回应答是什么？](https://open.unionpay.com/tjweb/support/faq/mchlist?id=72)\n* [交易状态查询接口什么时候调用？](https://open.unionpay.com/tjweb/support/faq/mchlist?id=77)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartwalle%2Funionpay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartwalle%2Funionpay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartwalle%2Funionpay/lists"}