golang支付合集(包括微信支付,支付宝,后期会加入聚合支付).zip
立即下载
资源介绍:
golang支付库 想必gopher们都会抱怨go成熟的包太少,特别是go语言支付这块,网上的代码基本没有能用的,要么不全,要么有硬伤,所以结合网上和自己经验,抽出时间写的一部分代码,封装下分享出来,希望能给大家一点借鉴意义。原创不易,喜欢的朋友star一下吧~
# golangæ¯ä»åéï¼å
æ¬å¾®ä¿¡æ¯ä»ï¼æ¯ä»å®ï¼åæä¼å å
¥èåæ¯ä»ï¼å欢çæåstarä¸ä¸å§ï½
## tips:ä½è
æ°ä¹¦ãé¶åºç¡Goè¯è¨ç®æ³å®æãåºçäºï¼æ¬¢è¿äº¬ä¸å½å½è´ä¹°ï¼
#### å
è´¹å¼æºä»£ç åºï¼https://gitee.com/shirdonl/goAlgorithms
#### ï¼å½å½ï¼ð¥ð¥ð¥ð¥ð¥ð¥ æ´»å¨æ¢è´ä¸ï¼ï¼https://product.dangdang.com/11726270217.html
#### ï¼äº¬ä¸ï¼ð¥ð¥ð¥ð¥ð¥ð¥ æ´»å¨æ¢è´ä¸ï¼ï¼https://item.jd.com/14101229.html
## tips:ä½è
ãGo Webç¼ç¨å®ææ´¾ãåºçäºï¼æ¬¢è¿äº¬ä¸å½å½è´ä¹°ï¼
#### ï¼äº¬ä¸ï¼ð¥ð¥ð¥ð¥ð¥ð¥æ´»å¨æ¢è´ä¸......ï¼ï¼https://item.jd.com/13200972.html
#### ï¼å½å½ï¼ð¥ð¥ð¥ð¥ð¥ð¥æ´»å¨æ¢è´ä¸......ï¼ï¼http://product.dangdang.com/29225055.html
## tips:ä½è
ãGoè¯è¨é«çº§å¼åä¸å®æãåºçäºï¼æ¬¢è¿äº¬ä¸å½å½è´ä¹°ï¼
#### ï¼å½å½ï¼ð¥ð¥ð¥ð¥ð¥ð¥ æ´»å¨æ¢è´ä¸......ï¼ï¼http://product.dangdang.com/29359572.html
#### ï¼äº¬ä¸ï¼ð¥ð¥ð¥ð¥ð¥ð¥ æ´»å¨æ¢è´ä¸......ï¼ï¼https://item.jd.com/13594166.html
* golangæ¯ä»åº
æ³å¿
gopher们é½ä¼æ±æ¨goæççå
太å°ï¼ç¹å«æ¯goè¯è¨æ¯ä»è¿åï¼ç½ä¸ç代ç åºæ¬æ²¡æè½ç¨çï¼è¦ä¹ä¸å
¨ï¼è¦ä¹æ硬伤ï¼æ以ç»åç½ä¸åèªå·±ç»éªï¼æ½åºæ¶é´åçä¸é¨å代ç ï¼å°è£
ä¸å享åºæ¥ï¼å¸æè½ç»å¤§å®¶ä¸ç¹åé´æä¹ãååä¸æï¼å欢çæåstarä¸ä¸å§ï½
* æ¯æçæ¯ä»æ¹å¼
ç®åæ¯æ微信appï¼æ¯ä»å®ç½é¡µçï¼æ¯ä»å®appãè¦æ¯è°ææ°çæ¯ä»æ¹å¼ä¹å¯ä»¥å并ã
* 项ç®å¼æºåè®®ï¼[MIT](https://gitee.com/shirdonl/pays_with_go/blob/master/LICENSE)
* githubå°åï¼https://github.com/shirdonliao/pays_with_go
* 使ç¨æ¹æ³
* ##### 1.git clone https://gitee.com/shirdonl/pays_with_go.git æè
go get gitee.com/shirdonl/pays_with_go
* ##### 2.å¨èªå·±ç项ç®éè°ç¨ï¼ç¤ºä¾ä»£ç å¦ä¸ï¼ç¡®ä¿å¡«å
¥èªå·±çé
ç½®åæ°ï¼å¼åä¸æé®é¢æ¬¢è¿çè¨æè
å
³æ³¨å
¬ä¼å·:codebigdata
```javascript
package main
import (
"fmt"
"gitee.com/shirdonl/pays_with_go"
"gitee.com/shirdonl/pays_with_go/client"
"gitee.com/shirdonl/pays_with_go/common"
"gitee.com/shirdonl/pays_with_go/constant"
"net/http"
)
func main() {
//设置æ¯ä»å®è´¦å·ä¿¡æ¯
initClient()
//设置åè°å½æ°
initHandle()
//æ¯ä»
charge := new(common.Charge)
charge.PayMethod = constant.ALI_APP //æ¯ä»æ¹å¼
charge.MoneyFee = 1 // æ¯ä»é±åä½å
charge.Describe = "æµè¯è®¢å" //æ¯ä»æè¿°
charge.TradeNum = "88888888" //交æå·
charge.CallbackURL = "http://127.0.0.1/callback/aliappcallback" //åè°å°åå¿
é¡»è·ä¸é¢ä¸æ ·
//导å
¥å
fdata, err := pays_with_go.Pay(charge)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(fdata)
}
//
func initClient() {
client.InitAliAppClient(&client.AliAppClient{
PartnerID: "xxx",
SellerID: "xxxx",
AppID: "xxx",
PrivateKey: nil,
PublicKey: nil,
})
}
func initHandle() {
http.HandleFunc("callback/aliappcallback", func(w http.ResponseWriter, r *http.Request) {
//è¿åæ¯ä»ç»æ
aliResult, err := pays_with_go.AliAppCallback(w, r)
if err != nil {
fmt.Println(err)
//log.xxx
return
}
//æ¥ä¸æ¥å¤çèªå·±çé»è¾
fmt.Println(aliResult)
})
}
```
å
³æ³¨å
¬ä¼å·ï¼æºç 大æ°æ®ï¼è·åæµ·éç²¾åæç¨åæºç ã
![è¾å
¥å¾ç说æ](https://images.gitee.com/uploads/images/2020/1219/150248_4e689de1_448435.jpeg "qrcode_for_gh_98b00c86c473_258.jpg")