fork download
  1. <?php
  2. // Enter your code here, enjoy!
  3. // important
  4. // please change the credentials to your own credentials
  5. $secret_key = '66ee00f0bfc120.00832520';
  6. $authenticate_id = 'd5503c409532746ee91e9326f7676107';
  7. $authenticate_pw = '444a2180da61039b3f3ef801b5eda029';
  8.  
  9. $cardInfo = array (
  10. 'firstname' => 'Salvadore',
  11. 'lastname' => 'Junda',
  12. 'card_number' => '4551919257537193',
  13. 'expiration_month' => '12',
  14. 'expiration_year' => '33',
  15. 'cvc' => '111',
  16. 'secret_key' => '66ee00f0bfc120.00832520'
  17. );
  18.  
  19. $encrypted_card = encryptCardInfo();
  20. echo $encrypted_card;
  21.  
  22.  
  23. $payment = array(
  24. 'authenticate_id' => 'd5503c409532746ee91e9326f7676107',
  25. 'authenticate_pw' => '444a2180da61039b3f3ef801b5eda029',
  26. 'orderid' => '74578',
  27. 'transaction_type' => 'A',
  28. 'amount' => '12.99',
  29. 'currency' => 'USD',
  30. 'card_info' => $encrypted_card,
  31. 'email' => 'd.shvager@gmail.com',
  32. 'street' => '58th Street North Suite 335',
  33. 'city' => 'Clearwater',
  34. 'zip' => '33760',
  35. 'state' => 'FL',
  36. 'country' => 'USA',
  37. 'phone' => '+1 (406) 546-2918',
  38. 'transaction_hash' => '',
  39. 'customerip' => '87.133.20.156'
  40. );
  41.  
  42. $signature = "";
  43. ksort($payment);
  44. foreach ($payment as $key => $val) {
  45. if ($key != "signature") {
  46. $signature .= $val;
  47. }
  48. }
  49.  
  50. $signature = $signature . $secret_key;
  51.  
  52. echo ("\r\n--------------------\r\n");
  53. echo ($signature);
  54.  
  55. $signature = strtolower(sha1($signature));
  56.  
  57. echo ("\r\n--------------------\r\n");
  58. echo ($signature);
  59. echo ("\r\n--------------------\r\n");
  60. $payment['signature'] = $signature;
  61.  
  62. if (count($payment) > 0) {
  63. foreach ($payment as $key => $value) {
  64. echo ($key." : ".$value."\r\n");
  65. }
  66. }
  67.  
  68. $response = payment ($payment);
  69. echo ("\r\n--------------------\r\n");
  70. echo ($response);
  71.  
  72. function encryptCardInfo()
  73. {
  74. $string = preg_replace("/[^A-Za-z0-9 ]/", '', '66ee00f0bfc120.00832520');
  75. $encryption_key = substr($string, 0, 16);
  76. $cardInfo = array (
  77. 'firstname' => 'Salvadore',
  78. 'lastname' => 'Junda',
  79. 'card_number' => '4551919257537193',
  80. 'expiration_month' => '12',
  81. 'expiration_year' => '33',
  82. 'cvc' => '111',
  83. 'secret_key' => '66ee00f0bfc120.00832520'
  84. );
  85. // Generate an initialization vector
  86. $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
  87. // Encrypt the data using AES 256 encryption in CBC mode using our encryption key and initialization vector.
  88. $encrypted = openssl_encrypt(array_implode_with_keys($cardInfo), 'aes-256-cbc', $encryption_key, 0, $iv);
  89. // The $iv is just as important as the key for decrypting, so save it with our encrypted data using a unique separator (::)
  90. return base64_encode($encrypted . '::' . $iv);
  91. }
  92.  
  93. function array_implode_with_keys($array) {
  94. $return = '';
  95. if (count($array) > 0) {
  96. foreach ($array as $key => $value) {
  97. $return .= $key . '||' . $value . '__';
  98. }
  99. $return = substr($return, 0, strlen($return) - 2);
  100. }
  101. return $return;
  102. }
  103.  
  104.  
  105. function payment($payment)
  106. {
  107. $api_url = 'https://s...content-available-to-author-only...o.uk/v2/authorize';
  108. $data_stream = http_build_query($payment);
  109. $ch = curl_init();
  110. curl_setopt($ch, CURLOPT_POST, 1);
  111. curl_setopt($ch, CURLOPT_POSTFIELDS, $data_stream);
  112. curl_setopt($ch, CURLOPT_URL, $api_url);
  113. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  114. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  115. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  116. $result_str = curl_exec($ch);
  117. if (curl_errno($ch) != 0) {
  118. $result_str = 'curl_error=' . curl_errno($ch);
  119. }
  120. curl_close($ch);
  121. return $result_str;
  122.  
  123. }
  124.  
  125.  
  126. ?>
Success #stdin #stdout 0.03s 26660KB
stdin
Standard input is empty
stdout
K2JTdjA3L2VqN3ZHZ0lxUHBXWlQvTkQ5QUNBNzduWWY2MGNXVlp3czZTcENWa09WTnF2U3JvWVRxZmw5dTlURHFtWDB1cHRqSldrK20rYWNKUUhYWW9KQzRZMmJ4QXpQMVdpcjFOTDl3b2dIOVdjZ2dEN3Voc3VMRGU5VXpKbFdkWmNMMkpsa1pjbzBrL1JpK1RyMkRqTktSU01oeTZaMFVzdzdGQlh3NTZhclN5NlcxcmdFTU5vYWtTblVYUGJ5NHlYaG4wVmZMdXp3b0VPbTVxbUhwZz09OjqFKrQUdFLibfXlGzUde6+k
--------------------
12.99d5503c409532746ee91e9326f7676107444a2180da61039b3f3ef801b5eda029K2JTdjA3L2VqN3ZHZ0lxUHBXWlQvTkQ5QUNBNzduWWY2MGNXVlp3czZTcENWa09WTnF2U3JvWVRxZmw5dTlURHFtWDB1cHRqSldrK20rYWNKUUhYWW9KQzRZMmJ4QXpQMVdpcjFOTDl3b2dIOVdjZ2dEN3Voc3VMRGU5VXpKbFdkWmNMMkpsa1pjbzBrL1JpK1RyMkRqTktSU01oeTZaMFVzdzdGQlh3NTZhclN5NlcxcmdFTU5vYWtTblVYUGJ5NHlYaG4wVmZMdXp3b0VPbTVxbUhwZz09OjqFKrQUdFLibfXlGzUde6+kClearwaterUSAUSD87.133.20.156d.shvager@gmail.com74578+1 (406) 546-2918FL58th Street North Suite 335A3376066ee00f0bfc120.00832520
--------------------
07650a05db9d5bbaa6fdfc8e44d023b59321f28c
--------------------
amount : 12.99
authenticate_id : d5503c409532746ee91e9326f7676107
authenticate_pw : 444a2180da61039b3f3ef801b5eda029
card_info : K2JTdjA3L2VqN3ZHZ0lxUHBXWlQvTkQ5QUNBNzduWWY2MGNXVlp3czZTcENWa09WTnF2U3JvWVRxZmw5dTlURHFtWDB1cHRqSldrK20rYWNKUUhYWW9KQzRZMmJ4QXpQMVdpcjFOTDl3b2dIOVdjZ2dEN3Voc3VMRGU5VXpKbFdkWmNMMkpsa1pjbzBrL1JpK1RyMkRqTktSU01oeTZaMFVzdzdGQlh3NTZhclN5NlcxcmdFTU5vYWtTblVYUGJ5NHlYaG4wVmZMdXp3b0VPbTVxbUhwZz09OjqFKrQUdFLibfXlGzUde6+k
city : Clearwater
country : USA
currency : USD
customerip : 87.133.20.156
email : d.shvager@gmail.com
orderid : 74578
phone : +1 (406) 546-2918
state : FL
street : 58th Street North Suite 335
transaction_hash : 
transaction_type : A
zip : 33760
signature : 07650a05db9d5bbaa6fdfc8e44d023b59321f28c

--------------------
curl_error=6