33 lines
529 B
Go
Raw Normal View History

2019-06-03 09:32:43 +00:00
package arn
import (
"os"
paypalsdk "github.com/logpacker/PayPal-Go-SDK"
)
var payPal *paypalsdk.Client
// PayPal returns the new PayPal SDK client.
func PayPal() (*paypalsdk.Client, error) {
if payPal != nil {
return payPal, nil
}
apiBase := paypalsdk.APIBaseSandBox
if IsProduction() {
apiBase = paypalsdk.APIBaseLive
}
// Create a client instance
c, err := paypalsdk.NewClient(APIKeys.PayPal.ID, APIKeys.PayPal.Secret, apiBase)
c.SetLog(os.Stdout)
if err != nil {
return nil, err
}
return c, nil
}