Hash Response (hashDataV2)
You must check the hashDataV2 information returned to you at the end of each payment transaction…
HashDataV2 is the hash information you need to check at the end of the payment transaction.
The parameters we return to you are as follows. It is important for your security that you create your hash with the method here and compare it with the hash coming from us. If the hashes are not the same, you can terminate the transaction.
The rnd value sent here is different from the value you sent in the request hash. This value is randomly generated by us.
RESPONSE_CODE : 2RESPONSE_DATA : Transaction Successful.REFERENCE_CODE : IKSIRPF3938836128USE_3D : trueMERCHANT_NO : 400000002AUTH_CODE : S32533320CLIENT_REFERENCE_CODE : 24809740TIMESTAMP : 2022-02-24 13:58:36.353TRANSACTION_AMOUNT : 1.00AUTHORIZATION_AMOUNT : 1.00COMMISION : 0.00COMMISION_RATE : 0.0000INSTALLMENT : 1RND : 1645700316156CURRENCY_CODE : TRYhashData : NL5R04M8C4sjDNgBUnEZ/RCocEo=hashDataV2 : Y4GMhUse2gPGV8UlDg6p96SZ7cDYR5mgUIp0p0cp0qbrvd14P4MS30KLlpC6oDbDaHceZ20XIJJdcvxHnOHJNg==
Response Hash Test
Section titled “Response Hash Test”With the variables we post to your Success page…
$hashstr = $MERCHANT_NO . "|" . $REFERENCE_CODE . "|" . $AUTH_CODE . "|" . $RESPONSE_CODE . "|" . $USE_3D . "|" . $RND . "|" . $INSTALLMENT . "|" . $AUTHORIZATION_AMOUNT . "|" . $CURRENCY_CODE . "|" . $MERCHANTSECRETKEY;$hash = mb_convert_encoding($hashstr, 'UTF-8');$hashedBytes = hash("sha512", $hash, true);$hashDataV2 = base64_encode($hashedBytes);
var raw = $"{MERCHANT_NO}|{REFERENCE_CODE}|{AUTH_CODE}|{RESPONSE_CODE}|{USE_3D}|{RND}|{INSTALLMENT}|{AUTHORIZATION_AMOUNT}|{CURRENCY_CODE}|{MERCHANTSECRETKEY}";using var sha512 = SHA512.Create();var hashDataV2 = Convert.ToBase64String(sha512.ComputeHash(Encoding.UTF8.GetBytes(raw)));
function calculateHash(merchantNo, referenceCode, authCode, responseCode, use3D, rnd, installment, authAmount, currencyCode, merchantSecretKey) { const raw = `${merchantNo}|${referenceCode}|${authCode}|${responseCode}|${use3D}|${rnd}|${installment}|${authAmount}|${currencyCode}|${merchantSecretKey}`; const hash = CryptoJS.SHA512(raw); return CryptoJS.enc.Base64.stringify(hash);}
import base64raw_string = f"{MERCHANT_NO}|{REFERENCE_CODE}|{AUTH_CODE}|{RESPONSE_CODE}|{USE_3D}|{RND}|{INSTALLMENT}|{AUTHORIZATION_AMOUNT}|{CURRENCY_CODE}|{MERCHANTSECRETKEY}"hash_data_v2 = base64.b64encode(hashlib.sha512(raw_string.encode('utf-8')).digest()).decode('utf-8')print(f"Generated Hash: {hash_data_v2}")