{"id":18650919,"url":"https://github.com/aimuz/wechat-sdk","last_synced_at":"2025-04-11T15:30:56.373Z","repository":{"id":57488511,"uuid":"123259525","full_name":"aimuz/wechat-sdk","owner":"aimuz","description":"微信登录支付sdk，支持小程序，APP登录，正在重构。全新版本: https://github.com/aimuz/wgo","archived":false,"fork":false,"pushed_at":"2020-01-24T08:45:51.000Z","size":58,"stargazers_count":80,"open_issues_count":0,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T15:08:06.373Z","etag":null,"topics":["golang","wechat","wechat-pay","wechat-sdk","weixin","weixin-sdk"],"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/aimuz.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}},"created_at":"2018-02-28T09:10:37.000Z","updated_at":"2025-02-12T09:02:29.000Z","dependencies_parsed_at":"2022-08-29T15:01:22.486Z","dependency_job_id":null,"html_url":"https://github.com/aimuz/wechat-sdk","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/aimuz%2Fwechat-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimuz%2Fwechat-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimuz%2Fwechat-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimuz%2Fwechat-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimuz","download_url":"https://codeload.github.com/aimuz/wechat-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248431307,"owners_count":21102178,"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":["golang","wechat","wechat-pay","wechat-sdk","weixin","weixin-sdk"],"created_at":"2024-11-07T06:47:27.263Z","updated_at":"2025-04-11T15:30:55.983Z","avatar_url":"https://github.com/aimuz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wechat-sdk\n[![Go Report Card](https://goreportcard.com/badge/github.com/aimuz/wechat-sdk)](https://goreportcard.com/report/github.com/aimuz/wechat-sdk)\n[![Build Status](https://travis-ci.org/aimuz/wechat-sdk.svg?branch=master)](https://travis-ci.org/aimuz/wechat-sdk)\n\n最全最好用的微信SDK，支持APP，小程序，H5，Web登录支付，企业付款等功能\n\n\n## 快速开始\n以下是APP和小程序支付简单例子\n```go\nimport \"github.com/aimuz/wechat-sdk/pay\"\n\nwePay := \u0026WePay{\n\tAppId:     \"xxx\",\n\tMchId:     \"xxx\",\n\tPayKey:    \"xxx\",\n\tNotifyUrl: \"xxx\",\n\tTradeType: \"xxx\", // APP支付填写`APP`,小程序支付填写`JSAPI`\n\tBody:      \"xxx\",\n}\n\n# APP支付\nresults, outTradeNo, err := wePay.AppPay(100) // 金额，以分为单位\n\n# 小程序支付\nresults, outTradeNo, err := wePay.WaxPay(100, \"open_id\") // 金额，以分为单位；open_id为获取的用户的open_id\n```\n\n## 使用\n### 小程序支付通知\n```go\nwaxNotify := pay.WaxPayNotifyReq{}\nctx.ReadXML(\u0026waxNotify)\nverifyParams := pay.WaxVerifyParams(waxNotify)\nvalid := pay.WaxpayVerifySign(verifyParams, appKey, waxNotify.Sign) //appKey 为自己在微信支付后台设置的API密钥\n\nresp := new(pay.WaxPayNotifyResp)\n\nif valid {\n\t// 业务处理逻辑···\n\tresp.ReturnCode = \"SUCCESS\"\n\tresp.ReturnMsg = \"OK\"\n} else {\n\t// 错误处理逻辑···\n\tresp.ReturnCode = \"FAIL\"\n\tresp.ReturnMsg = \"Verify Failed\"\n}\n```\n\n### 发送普通红包\n```go\nwx := \u0026WePay{\n\tAppID:      \"xx\",\n\tPayKey:     \"xx\",\n\tMchID:      \"xx\",\n\tTradeType:  \"xx\",\n\tCertFile:   \"xx\", // 证书路径\n\tkeyFile:    \"xx\", // 证书秘钥路径\n\tRootCaFile: \"xx\", // 根证书路径\n}\n\nbillNO, redPackResp, err := wx.SendRedPack(totalAmount, openID, sendName, wishing, actName, remark)\n\n```\n\n#### APP支付\n\n##### APP简单使用\n\n## 讨论\n\n[issues](https://github.com/aimuz/wechat-sdk/issues)\n\n[论坛](https://kezhan.io/t/aimuz.wechat-sdk)\n\n## 支持功能\n\n- [x] APP支付\n- [x] APP登录\n- [x] H5登录\n- [x] 小程序登录\n- [x] 小程序支付\n- [ ] Web登录\n- [ ] 公众号支付\n- [ ] 扫码支付\n- [ ] 刷卡支付\n- [ ] 企业付款\n- [x] 现金红包\n   - [x] 发送红包\n   - [ ] 裂变红包\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimuz%2Fwechat-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimuz%2Fwechat-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimuz%2Fwechat-sdk/lists"}