Posted By

Hexahow on 03/11/13


Tagged

transaction fraud preventionfraud checkgeolocationblacklist


Versions (?)

FraudLabs Pro - Order screening to prevent fraud


 / Published in: PHP
 

URL: http://www.fraudlabspro.com

This sample code shows you how to screen an order by entering all the relevant information into the request parameters.

  1. <?php
  2. $apiKey = 'Enter_License_Key';
  3. $params['format'] = 'json';
  4. $params['ip'] = $_SERVER['REMOTE_ADDR'];
  5. $params['bill_city'] = 'Cleveland';
  6. $params['bill_state'] = 'OH';
  7. $params['bill_zip_code'] = '44115';
  8. $params['bill_country'] = 'US';
  9. $params['ship_addr'] = '4987 Bingamon Road';
  10. $params['ship_city'] = 'Cleveland';
  11. $params['ship_state'] = 'OH';
  12. $params['ship_zip_code'] = '44115';
  13. $params['ship_country'] = 'US';
  14. $params['email_domain'] = 'gmail.com';
  15. $params['phone'] = '440-5551961';
  16. $params['email_hash'] = fraudlabspro_hash('[email protected]');
  17. $params['username_hash'] = fraudlabspro_hash('kevinowen');
  18. $params['password_hash'] = fraudlabspro_hash('3X2hd8cWNw9q');
  19. $params['bin_no'] = '558265';
  20. $params['bank_name'] = 'Bank of Ocean View';
  21. $params['bank_phone'] = '212-500-2489';
  22. $params['card_hash'] = fraudlabspro_hash('5582657189029269');
  23. $params['avs_result'] = 'Y';
  24. $params['cvv_result'] = 'M';
  25. $params['user_order_id'] = '7893';
  26. $params['amount'] = '99.95';
  27. $params['quantity'] = '1';
  28. $params['department'] = 'Online Store';
  29. $params['payment_mode'] = 'creditcard';
  30.  
  31. $query = '';
  32.  
  33. foreach($params as $key=>$value){
  34. $query .= '&' . $key . '=' . rawurlencode($value);
  35. }
  36.  
  37. $try = 0;
  38. do {
  39. $result = file_get_contents('https://api.fraudlabspro.com/v1/order/screen?key=' . $apiKey . $query);
  40. } while(!$result && $rty++ < 3);
  41.  
  42. $data = json_decode($result);
  43.  
  44. echo '<pre>';
  45. print_r($data);
  46. echo '</pre>';
  47.  
  48. function fraudlabspro_hash($s){
  49. $hash = 'fraudlabspro_' . $s;
  50. for($i=0; $i<65536; $i++) $hash = sha1('fraudlabspro_' . $hash);
  51.  
  52. return $hash;
  53. }
  54. ?>

Report this snippet  

You need to login to post a comment.