본문으로 건너뛰기

서명

HaloPay API는 AppId와 AppKey로 요청을 인증합니다. HaloPay 계정에 로그인한 후 앱 관리 페이지에서 AppIdAppKey를 확인할 수 있습니다.

정보

AppId와 AppKey는 높은 권한을 가지므로 안전하게 보관하세요. GitHub, 클라이언트 코드 등 공개 영역에 공유하지 마세요.

서명 가이드

헤더

이름타입설명
X-Signstring서명
X-Timestampint타임스탬프(초)
X-Appidstring가맹점 APPID
content-typestringapplication/json

서명 알고리즘

// sign (golang)
func hmacSHA256Sign(appKey, timestamp string, body interface{}) (string, error) {
jsonStr, err := json.Marshal(body)
if err != nil {
return "", err
}
sha256Mac := hmac.New(sha256.New, []byte(appKey))
_, err = sha256Mac.Write(append(jsonStr, []byte(timestamp)...))
if err != nil {
return "", err
}
return hex.EncodeToString(sha256Mac.Sum(nil)), nil
}