We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The transHashSHA2 should be checked here in order to confirm there wasn't a man-in-the-middle attack:
https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-credit-card.php#L97
Something like this:
$authorize_hash = $tresponse->getTransHashSha2(); $string = '^' . \SampleCodeConstants::MERCHANT_LOGIN_ID . '^' . $tresponse->getTransId(). '^' . $amount . '^'; $key = hex2bin( \SampleCodeConstants::MERCHANT_SIGNATURE_KEY ); $my_hash = strtoupper( hash_hmac( 'sha512', $string, $key ) ); if( hash_equals ( $authorize_hash, $my_hash ) ) { echo " Successfully created transaction with Transaction ID: " . $tresponse->getTransId() . "\n"; echo " Transaction Response Code: " . $tresponse->getResponseCode() . "\n"; echo " Message Code: " . $tresponse->getMessages()[0]->getCode() . "\n"; echo " Auth Code: " . $tresponse->getAuthCode() . "\n"; echo " Description: " . $tresponse->getMessages()[0]->getDescription() . "\n"; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The transHashSHA2 should be checked here in order to confirm there wasn't a man-in-the-middle attack:
https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-credit-card.php#L97
Something like this:
The text was updated successfully, but these errors were encountered: