<?php
// Enter your code here, enjoy!
// important
// please change the credentials to your own credentials
$secret_key = '66ee00f0bfc120.00832520';
$authenticate_id = 'd5503c409532746ee91e9326f7676107';
$authenticate_pw = '444a2180da61039b3f3ef801b5eda029';
'firstname' => 'Salvadore',
'lastname' => 'Junda',
'card_number' => '4551919257537193',
'expiration_month' => '12',
'expiration_year' => '33',
'cvc' => '111',
'secret_key' => '66ee00f0bfc120.00832520'
);
$encrypted_card = encryptCardInfo();
echo $encrypted_card;
'authenticate_id' => 'd5503c409532746ee91e9326f7676107',
'authenticate_pw' => '444a2180da61039b3f3ef801b5eda029',
'orderid' => '74578',
'transaction_type' => 'A',
'amount' => '12.99',
'currency' => 'USD',
'card_info' => $encrypted_card,
'email' => 'd.shvager@gmail.com',
'street' => '58th Street North Suite 335',
'city' => 'Clearwater',
'zip' => '33760',
'state' => 'FL',
'country' => 'USA',
'phone' => '+1 (406) 546-2918',
'transaction_hash' => '',
'customerip' => '87.133.20.156'
);
$signature = "";
foreach ($payment as $key => $val) {
if ($key != "signature") {
$signature .= $val;
}
}
$signature = $signature . $secret_key;
echo ("\r\n--------------------\r\n");
echo ($signature);
echo ("\r\n--------------------\r\n");
echo ($signature);
echo ("\r\n--------------------\r\n");
$payment['signature'] = $signature;
if (count($payment) > 0) { foreach ($payment as $key => $value) {
echo ($key." : ".$value."\r\n");
}
}
$response = payment ($payment);
echo ("\r\n--------------------\r\n");
echo ($response);
function encryptCardInfo()
{
$string = preg_replace("/[^A-Za-z0-9 ]/", '', '66ee00f0bfc120.00832520'); $encryption_key = substr($string, 0, 16); 'firstname' => 'Salvadore',
'lastname' => 'Junda',
'card_number' => '4551919257537193',
'expiration_month' => '12',
'expiration_year' => '33',
'cvc' => '111',
'secret_key' => '66ee00f0bfc120.00832520'
);
// Generate an initialization vector
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
// Encrypt the data using AES 256 encryption in CBC mode using our encryption key and initialization vector.
$encrypted = openssl_encrypt(array_implode_with_keys($cardInfo), 'aes-256-cbc', $encryption_key, 0, $iv);
// The $iv is just as important as the key for decrypting, so save it with our encrypted data using a unique separator (::)
}
function array_implode_with_keys($array) {
$return = '';
foreach ($array as $key => $value) {
$return .= $key . '||' . $value . '__';
}
}
return $return;
}
function payment($payment)
{
$api_url = 'https://s...content-available-to-author-only...o.uk/v2/authorize';
}
return $result_str;
}
?>
PD9waHAKLy8gRW50ZXIgeW91ciBjb2RlIGhlcmUsIGVuam95IQovLyBpbXBvcnRhbnQKICAgIC8vIHBsZWFzZSBjaGFuZ2UgdGhlIGNyZWRlbnRpYWxzIHRvIHlvdXIgb3duIGNyZWRlbnRpYWxzCiAgICAkc2VjcmV0X2tleSA9ICc2NmVlMDBmMGJmYzEyMC4wMDgzMjUyMCc7CiAgICAkYXV0aGVudGljYXRlX2lkID0gJ2Q1NTAzYzQwOTUzMjc0NmVlOTFlOTMyNmY3Njc2MTA3JzsKICAgICRhdXRoZW50aWNhdGVfcHcgPSAnNDQ0YTIxODBkYTYxMDM5YjNmM2VmODAxYjVlZGEwMjknOwogICAgCiAgICAkY2FyZEluZm8gPSBhcnJheSAoCiAgICAgICAgJ2ZpcnN0bmFtZScgPT4gJ1NhbHZhZG9yZScsCiAgICAgICAgJ2xhc3RuYW1lJyA9PiAnSnVuZGEnLAogICAgICAgICdjYXJkX251bWJlcicgPT4gJzQ1NTE5MTkyNTc1MzcxOTMnLAogICAgICAgICdleHBpcmF0aW9uX21vbnRoJyA9PiAnMTInLAogICAgICAgICdleHBpcmF0aW9uX3llYXInID0+ICczMycsCiAgICAgICAgJ2N2YycgPT4gJzExMScsCiAgICAgICAgJ3NlY3JldF9rZXknID0+ICc2NmVlMDBmMGJmYzEyMC4wMDgzMjUyMCcKICAgICk7CiAgICAKICAgICRlbmNyeXB0ZWRfY2FyZCA9IGVuY3J5cHRDYXJkSW5mbygpOwogICAgZWNobyAgJGVuY3J5cHRlZF9jYXJkOwogICAgCiAgICAKICAgICRwYXltZW50ID0gYXJyYXkoCiAgICAgICAgJ2F1dGhlbnRpY2F0ZV9pZCcgPT4gJ2Q1NTAzYzQwOTUzMjc0NmVlOTFlOTMyNmY3Njc2MTA3JywKICAgICAgICAnYXV0aGVudGljYXRlX3B3JyA9PiAnNDQ0YTIxODBkYTYxMDM5YjNmM2VmODAxYjVlZGEwMjknLAogICAgICAgICdvcmRlcmlkJyA9PiAnNzQ1NzgnLAogICAgICAgICd0cmFuc2FjdGlvbl90eXBlJyA9PiAnQScsCiAgICAgICAgJ2Ftb3VudCcgPT4gJzEyLjk5JywKICAgICAgICAnY3VycmVuY3knID0+ICdVU0QnLAogICAgICAgICdjYXJkX2luZm8nID0+ICRlbmNyeXB0ZWRfY2FyZCwKICAgICAgICAnZW1haWwnID0+ICdkLnNodmFnZXJAZ21haWwuY29tJywKICAgICAgICAnc3RyZWV0JyA9PiAnNTh0aCBTdHJlZXQgTm9ydGggU3VpdGUgMzM1JywKICAgICAgICAnY2l0eScgPT4gJ0NsZWFyd2F0ZXInLAogICAgICAgICd6aXAnID0+ICczMzc2MCcsCiAgICAgICAgJ3N0YXRlJyA9PiAnRkwnLAogICAgICAgICdjb3VudHJ5JyA9PiAnVVNBJywKICAgICAgICAncGhvbmUnID0+ICcrMSAoNDA2KSA1NDYtMjkxOCcsCiAgICAgICAgICd0cmFuc2FjdGlvbl9oYXNoJyA9PiAnJywKICAgICAgICAnY3VzdG9tZXJpcCcgPT4gJzg3LjEzMy4yMC4xNTYnCiAgICApOwogICAgCiAgICAkc2lnbmF0dXJlID0gIiI7CiAgICAgICAga3NvcnQoJHBheW1lbnQpOyAgIAogICAgICAgIGZvcmVhY2ggKCRwYXltZW50IGFzICRrZXkgPT4gJHZhbCkgewogICAgICAgICAgICBpZiAoJGtleSAhPSAic2lnbmF0dXJlIikgewogICAgICAgICAgICAgICAgJHNpZ25hdHVyZSAuPSAkdmFsOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIAogICAgICAgICRzaWduYXR1cmUgPSAkc2lnbmF0dXJlIC4gJHNlY3JldF9rZXk7IAogICAgCiAgICAgICAgZWNobyAoIlxyXG4tLS0tLS0tLS0tLS0tLS0tLS0tLVxyXG4iKTsKICAgICAgICBlY2hvICgkc2lnbmF0dXJlKTsKICAgIAogICAgICAgICRzaWduYXR1cmUgPSBzdHJ0b2xvd2VyKHNoYTEoJHNpZ25hdHVyZSkpOwogICAgICAgIAogICAgICAgIGVjaG8gKCJcclxuLS0tLS0tLS0tLS0tLS0tLS0tLS1cclxuIik7CiAgICAgICAgZWNobyAoJHNpZ25hdHVyZSk7CiAgICAgICAgZWNobyAoIlxyXG4tLS0tLS0tLS0tLS0tLS0tLS0tLVxyXG4iKTsKICAgICAgICAkcGF5bWVudFsnc2lnbmF0dXJlJ10gPSAkc2lnbmF0dXJlOwogICAgICAgIAogICAgICAgIGlmIChjb3VudCgkcGF5bWVudCkgPiAwKSB7CiAgICAgICAgICAgIGZvcmVhY2ggKCRwYXltZW50IGFzICRrZXkgPT4gJHZhbHVlKSB7CiAgICAgICAgICAgICAgICBlY2hvICgka2V5LiIgOiAiLiR2YWx1ZS4iXHJcbiIpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIAogICAgICAgICRyZXNwb25zZSA9IHBheW1lbnQgKCRwYXltZW50KTsKICAgICAgICBlY2hvICgiXHJcbi0tLS0tLS0tLS0tLS0tLS0tLS0tXHJcbiIpOwogICAgICAgIGVjaG8gKCRyZXNwb25zZSk7CiAgICAgICAgCiAgICBmdW5jdGlvbiBlbmNyeXB0Q2FyZEluZm8oKQogICAgewogICAgICAgICRzdHJpbmcgPSBwcmVnX3JlcGxhY2UoIi9bXkEtWmEtejAtOSBdLyIsICcnLCAnNjZlZTAwZjBiZmMxMjAuMDA4MzI1MjAnKTsKICAgICAgICAkZW5jcnlwdGlvbl9rZXkgPSBzdWJzdHIoJHN0cmluZywgMCwgMTYpOwogICAgICAgICRjYXJkSW5mbyA9IGFycmF5ICgKICAgICAgICAnZmlyc3RuYW1lJy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ycmF5X2ltcGxvZGVfd2l0aF9rZXlzKCRhcnJheSkgewogICAgICAgICRyZXR1cm4gPSAnJzsKICAgICAgICBpZiAoY291bnQoJGFycmF5KSA+IDApIHsKICAgICAgICAgICAgZm9yZWFjaCAoJGFycmF5IGFzICRrZXkgPT4gJHZhbHVlKSB7CiAgICAgICAgICAgICAgICAkcmV0dXJuIC49ICRrZXkgLiAnfHwnIC4gJHZhbHVlIC4gJ19fJzsKICAgICAgICAgICAgfQogICAgICAgICAgICAkcmV0dXJuID0gc3Vic3RyKCRyZXR1cm4sIDAsIHN0cmxlbigkcmV0dXJuKSAtIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gJHJldHVybjsKICAgIH0KICAgIAogICAgCiAgICBmdW5jdGlvbiBwYXltZW50KCRwYXltZW50KQogICAgewogICAgICAgICRhcGlfdXJsID0gJ2h0dHBzOi8vcy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uby51ay92Mi9hdXRob3JpemUnOwogICAgICAgICRkYXRhX3N0cmVhbSA9IGh0dHBfYnVpbGRfcXVlcnkoJHBheW1lbnQpOwogICAgICAgICRjaCA9IGN1cmxfaW5pdCgpOwogICAgICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9QT1NULCAxKTsKICAgICAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfUE9TVEZJRUxEUywgJGRhdGFfc3RyZWFtKTsKICAgICAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfVVJMLCAkYXBpX3VybCk7CiAgICAgICAgY3VybF9zZXRvcHQoJGNoLCBDVVJMT1BUX1NTTF9WRVJJRllIT1NULCAyKTsKICAgICAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfUkVUVVJOVFJBTlNGRVIsIDEpOwogICAgICAgIGN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9TU0xfVkVSSUZZUEVFUiwgRkFMU0UpOwogICAgICAgICRyZX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