Required headers
Mỗi yêu cầu phải chứa ba header bắt buộc:
X-Timestamp | Unix timestamp tính bằng giây |
X-Signature | Chữ ký yêu cầu HMAC-SHA256 ở định dạng hex |
X-Client-Id | ID merchant của bạn |
Signature generation
Chữ ký được tạo dựa trên timestamp và nội dung yêu cầu.
Định dạng:
{timestamp}.{canonicalBody}
Format description
timestamp | Thời gian Unix hiện tại tính bằng giây |
canonicalBody | Nội dung JSON của yêu cầu được chuẩn hóa |
Thuật toán chữ ký:
Yêu cầu quan trọng:
Ví dụ:
Authorization errors
401 Invalid X-Timestamp
{
"status": 401,
"message": "Invalid X-Timestamp"
}401 Expired X-Timestamp
{
"status": 401,
"message": "Expired X-Timestamp"
}401 Invalid X-Signature
{
"status": 401,
"message": "Invalid X-Signature"
}401 Invalid token
{
"status": 401,
"message": "Invalid token"
}401 Merchant secret not configured
{
"status": 401,
"message": "Merchant secret not configured"
}500 Internal Server Error
{
"status": 500,
"message": "Internal Server Error"
}