You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
520 B
26 lines
520 B
3 years ago
|
package alipay
|
||
|
|
||
|
import "github.com/smartwalle/alipay/v3"
|
||
|
|
||
|
type Config struct {
|
||
|
AppId string
|
||
|
PrivateKey string
|
||
|
AliPublicKey string
|
||
|
IsProduction bool
|
||
|
}
|
||
|
|
||
|
var Alipay *alipay.Client
|
||
|
|
||
|
// InitAlipay @Title 初始化支付宝配置
|
||
|
func InitAlipay(config Config) (err error) {
|
||
|
Alipay, err = alipay.New(config.AppId, config.PrivateKey, config.IsProduction)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
// 加载阿里公钥
|
||
|
if err = Alipay.LoadAliPayPublicKey(config.AliPublicKey); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|