{"id":13826863,"url":"https://github.com/milkbobo/gopay","last_synced_at":"2025-04-04T20:14:41.354Z","repository":{"id":50619603,"uuid":"82281194","full_name":"milkbobo/gopay","owner":"milkbobo","description":"golang支付:微信公众号，微信app，微信小程序，微信企业支付，支付宝网页版，支付宝app，支付宝企业支付","archived":false,"fork":false,"pushed_at":"2020-12-16T07:35:30.000Z","size":56,"stargazers_count":402,"open_issues_count":1,"forks_count":121,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-28T19:10:04.696Z","etag":null,"topics":["alipay","alipaysdk","go","golang","miniprogram","pay","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milkbobo.png","metadata":{"files":{"readme":"README.org","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}},"created_at":"2017-02-17T09:36:47.000Z","updated_at":"2025-02-17T03:26:01.000Z","dependencies_parsed_at":"2022-09-26T21:30:44.833Z","dependency_job_id":null,"html_url":"https://github.com/milkbobo/gopay","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkbobo%2Fgopay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkbobo%2Fgopay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkbobo%2Fgopay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkbobo%2Fgopay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milkbobo","download_url":"https://codeload.github.com/milkbobo/gopay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"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","alipaysdk","go","golang","miniprogram","pay","payment","wechat"],"created_at":"2024-08-04T09:01:45.639Z","updated_at":"2025-04-04T20:14:41.311Z","avatar_url":"https://github.com/milkbobo.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/milkbobo/gopay\"\n\t\"github.com/milkbobo/gopay/client\"\n\t\"github.com/milkbobo/gopay/common\"\n\t\"github.com/milkbobo/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%2Fmilkbobo%2Fgopay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilkbobo%2Fgopay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilkbobo%2Fgopay/lists"}