Created
June 4, 2012 16:51
-
-
Save craigchristenson/2869509 to your computer and use it in GitHub Desktop.
Example PHP script to check fraud status on a sale.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_POST['message_type'] == 'FRAUD_STATUS_CHANGED') { | |
$insMessage = array(); | |
foreach ($_POST as $k => $v) { | |
$insMessage[$k] = $v; | |
} | |
$hashSecretWord = "tango"; # Input your secret word | |
$hashSid = 1303908; #Input your seller ID (2Checkout account number) | |
$hashOrder = $insMessage['sale_id']; | |
$hashInvoice = $insMessage['invoice_id']; | |
$StringToHash = strtoupper(md5($hashOrder . $hashSid . $hashInvoice . $hashSecretWord)); | |
if ($StringToHash != $insMessage['md5_hash']) { | |
die('Hash Incorrect'); | |
} | |
switch ($insMessage['fraud_status']) { | |
case 'pass': | |
# Do something when sale passes fraud review. | |
break; | |
case 'fail': | |
# Do something when sale fails fraud review. | |
break; | |
case 'wait': | |
# Do something when sale requires additional fraud review. | |
break; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment