{"id":13600829,"url":"https://github.com/guidao/gopay","last_synced_at":"2026-03-17T22:09:17.088Z","repository":{"id":151183283,"uuid":"65721946","full_name":"guidao/gopay","owner":"guidao","description":"golang语言实现的支付模块，支持支付宝app，支付宝网页版，微信app,微信公众号支付","archived":false,"fork":false,"pushed_at":"2017-01-18T12:17:52.000Z","size":18,"stargazers_count":158,"open_issues_count":1,"forks_count":49,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-24T15:21:35.872Z","etag":null,"topics":["alipay","payment","wechat"],"latest_commit_sha":null,"homepage":"","language":"Go","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/guidao.png","metadata":{"files":{"readme":"README.org","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":"2016-08-15T09:46:15.000Z","updated_at":"2025-01-13T23:23:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"97a8d332-5049-4186-94b6-ddd394b002e9","html_url":"https://github.com/guidao/gopay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guidao%2Fgopay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guidao%2Fgopay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guidao%2Fgopay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guidao%2Fgopay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guidao","download_url":"https://codeload.github.com/guidao/gopay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262171,"owners_count":21074257,"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":["alipay","payment","wechat"],"created_at":"2024-08-01T18:00:49.502Z","updated_at":"2026-03-17T22:09:17.038Z","avatar_url":"https://github.com/guidao.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"* golang语言实现的支付库\n最近在搞支付这块，但是网上的代码基本没有能用的，要么不全，要么有硬伤，所以最后还是自己接了。抽出写的一部分代码，封装下分享出来，希望能给大家一点借鉴意义。\n* 支持的支付方式\n目前支持微信app，支付宝网页版，支付宝app。要是谁有新的支付方式也可以合并。\n* 使用方法\n#+BEGIN_SRC go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/guidao/gopay\"\n\t\"github.com/guidao/gopay/client\"\n\t\"github.com/guidao/gopay/common\"\n\t\"github.com/guidao/gopay/constant\"\n\t\"net/http\"\n)\n\n//支付宝举例\nfunc main() {\n\t//设置支付宝账号信息\n\tinitClient()\n\t//设置回调函数\n\tinitHandle()\n\n\t//支付\n\tcharge := new(common.Charge)\n\tcharge.PayMethod = constant.WECHAT                              //支付方式\n\tcharge.MoneyFee = 1                                             // 支付钱单位分\n\tcharge.Describe = \"test pay\"                                    //支付描述\n\tcharge.TradeNum = \"1111111111\"                                  //交易号\n\tcharge.CallbackURL = \"http://127.0.0.1/callback/aliappcallback\" //回调地址必须跟下面一样\n\n\tfdata, err := gopay.Pay(charge)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(fdata)\n}\n\nfunc initClient() {\n\tclient.InitAliAppClient(\u0026client.AliAppClient{\n\t\tPartnerID:  \"xxx\",\n\t\tSellerID:   \"xxxx\",\n\t\tAppID:      \"xxx\",\n\t\tPrivateKey: nil,\n\t\tPublicKey:  nil,\n\t})\n}\n\nfunc initHandle() {\n\thttp.HandleFunc(\"callback/aliappcallback\", func(w http.ResponseWriter, r *http.Request) {\n\t\t//返回支付结果\n\t\taliResult, err := gopay.AliAppCallback(w, r)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\t//log.xxx\n\t\t\treturn\n\t\t}\n\t\t//接下来处理自己的逻辑\n\t\tfmt.Println(aliResult)\n\t})\n}\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguidao%2Fgopay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguidao%2Fgopay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguidao%2Fgopay/lists"}