メインコンテンツまでスキップ

署名

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
}