【发布时间】:2016-05-01 11:36:36
【问题描述】:
我正在使用 Authorize.Net 来集成在线信用卡处理。我使用的表单将在单击提交按钮后重定向到 Authorize.net hosted form。我的示例代码如下
<?PHP
$loginID = "My_LOGIN_ID";// login id
$transactionKey = "MY_TRANS_KEY";//transaction key
$amount = "19.99";
$description = "SAMPLE TRANSACTION";
$label = "Submit Payment";//label for submit button
$testMode = "false";
$url = "https://test.authorize.net/gateway/transact.dll";
$invoice = date(YmdHis);
$sequence = rand(1, 1000);
$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)); }
?>
<form method='post' action='<?php echo $url; ?>' >
<input type='hidden' name='x_login' value='<?php echo $loginID; ?>' />
<input type='hidden' name='x_amount' value='<?php echo $amount; ?>' />
<input type='hidden' name='x_description' value='<?php echo $description; ?>' />
<input type='hidden' name='x_invoice_num' value='<?php echo $invoice; ?>' />
<input type='hidden' name='x_fp_sequence' value='<?php echo $sequence; ?>' />
<input type='hidden' name='x_fp_timestamp' value='<?php echo $timeStamp; ?>' />
<input type='hidden' name='x_fp_hash' value='<?php echo $fingerprint; ?>' />
<input type='hidden' name='x_test_request' value='<?php echo $testMode; ?>' />
<input type='hidden' name='x_show_form' value='<?php echo PAYMENT_FORM; ?>' />
<input type='submit' value='<?php echo $label; ?>' />
</form>
在Authorize.net hosted form提交了正确的信用卡和个人信息后,我收到了如下的交易成功信息
我还收到了包含交易详情的电子邮件。现在我想在交易成功后将交易详情,如交易 ID、发票号码、信用卡类型和客户详情保存在我的数据库中。是否有任何后台进程将信息保存到数据库中?提前致谢。
【问题讨论】:
标签: php authorize.net