Authorize.Net
Sample SIM Implementation
<?PHP $loginID = "API_LOGIN_ID";
$transactionKey = "TRANSACTION_KEY";
$amount = "19.99";
$description = "Sample Transaction";
$label = "Submit Payment"; // The is the label on the 'submit' button
$testMode = "false"; // 是否开启测试功能, 如果开启,则网上付款都是测试,paypal也有此功能,只是方式不一样
$url = "https://test.authorize.net/gateway/transact.dll"; // 这个是测试地址,实际付款地址为: $url = "https://secure.authorize.net/gateway/transact.dll"
// If an amount or description were posted to this page, the defaults are overidden
if ($_REQUEST["amount"])
{ $amount = $_REQUEST["amount"]; }
if ($_REQUEST["description"])
{ $description = $_REQUEST["description"]; }
// an invoice is generated using the date and time
$invoice = date(YmdHis);
// a sequence number is randomly generated
$sequence = rand(1, 1000);
// a timestamp is generated
$timeStamp = time ();
if( phpversion() >= '5.1.2' )
{ $fingerprint = hash_hmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey); }
else
{ $fingerprint = bin2hex(mhash(MHASH_MD5, $loginID . "^" . $sequence .
"^" . $timeStamp . "^" . $amount . "^", $transactionKey)); }
echo "Amount: $amount
";
echo "Description: $description
";
// 创建html 表单,里面包含了必须的SIM 内容
echo "";
// Additional fields can be added here as outlined in the SIM integration guide
// at: http://developer.authorize.net
echo " "; // ID
echo " "; // 付款金额
echo " "; // 描述
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
?>
当然也可以加入一些非必须内容,例如
转载于:https://www.cnblogs.com/newyork/archive/2009/12/10/1621337.html