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.
pay/alipay.go

26 lines
529 B

package pay
import "github.com/smartwalle/alipay/v3"
type AlipayConfig struct {
AppId string
PrivateKey string
AliPublicKey string
IsProduction bool
}
var Alipay *alipay.Client
// InitAlipay @Title 初始化支付宝配置
func InitAlipay(config AlipayConfig) (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
}