Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
优秀的.net PHP库_Php_Payment Gateway_Authorize.net - Fatal编程技术网

优秀的.net PHP库

优秀的.net PHP库,php,payment-gateway,authorize.net,Php,Payment Gateway,Authorize.net,我正在从事一个PHP项目,正在寻找一个好的authorize.net网关。我想要一些经过测试的成熟代码。目标是避免自己基于authorize.net api文档编写和测试整个程序 有人知道这方面有什么好的PHP库吗?我在谷歌上搜索没有结果。 这就是我使用的类。使用起来相当简单。不过,您仍然需要深入研究API,以确定要发送哪些变量以及不发送哪些变量。Magento支持Authorize.Net。提取出您需要的代码,因为Magento是经过良好测试的高质量代码。您很幸运。这是我使用的(SIM网关):

我正在从事一个PHP项目,正在寻找一个好的authorize.net网关。我想要一些经过测试的成熟代码。目标是避免自己基于authorize.net api文档编写和测试整个程序

有人知道这方面有什么好的PHP库吗?我在谷歌上搜索没有结果。


这就是我使用的类。使用起来相当简单。不过,您仍然需要深入研究API,以确定要发送哪些变量以及不发送哪些变量。

Magento支持Authorize.Net。提取出您需要的代码,因为Magento是经过良好测试的高质量代码。

您很幸运。这是我使用的(SIM网关):


这是一个在CodeIgniter中使用的不错的库,但它可以单独使用:


信用证:詹姆斯·吉福德(james gifford)提供了代码。

我使用了Kohana 2.3.x中包含的支付模块以及内置的Authorize.Net驱动程序

我认为simdata.php只包含事务数据。。。如金额、此人的名字等。

詹姆斯·吉福德为codeigniter创建了一些Authorize.net代码。在这里下载

我正在使用直接从Authorize.nets开发站点获得的php sdk


Authorize.net提供自己的。可能没有必要去别处查看。

表单方法是传递此信息的一种不安全的方式。更好的选择是使用他们的API AIM方法

在这里可以找到一个很棒的教程:

我认为他更多的是在寻找一个现成的解决方案。挖掘magento的代码可能比他寻找的工作要多。链接似乎不再有效。我不确定我最初问这个问题时他们是否提供了这些。。。只有一个规范:)@markwatson我肯定不是因为我差不多在同一时间实现了一个,如果他们有SDK,我会使用它:)我查看了他们的SDK……并决定实现我自己的SDK。他们的SDK比普通的RESTAPI集成更令人困惑。请注意,$x_tran_key不是Authorize.Net事务密钥。它是在设置下对其帐户生成的MD5哈希。我一次又一次地运行你的代码,直到我弄明白这个事实,才让它工作。使用这种方法会有任何实际的安全惩罚吗?这仍然会受到什么样的攻击?我知道的比当时更多,我不会使用
rand
,而是使用
mcrypt\u create\u iv
。如果我今天这样做,我会使用他们的API。
include("../../simdata.php");
...
<!--form action="https://test.authorize.net/gateway/transact.dll" method="POST"-->
<FORM action="https://secure.authorize.net/gateway/transact.dll" method="POST">
<?
$x_description = "website.com";
$currency = "";
$tstamp = time();
// Seed random number for security and better randomness.
srand(time());
$sequence = rand(1, 1000);
$data = "$x_loginid^$sequence^$tstamp^$total^$currency";
#echo "data = $data\n";
#echo $x_tran_key;
$fingerprint = bin2hex(mhash(MHASH_MD5, $data, $x_tran_key));
# php 5 only $fingerprint = hash_hmac("md5", $data, $x_tran_key);
echo ("<input type='hidden' name='x_fp_sequence' value='" . $sequence . "'>\n" );
echo ("<input type='hidden' name='x_fp_timestamp' value='" . $tstamp . "'>\n" );
echo ("<input type='hidden' name='x_fp_hash' value='" . $fingerprint . "'>\n" );
echo ("<input type=\"hidden\" name=\"x_description\" value=\"" . $x_description . "\">\n" );
echo ("<input type=\"hidden\" name=\"x_login\" value=\"$x_loginid\">\n");
echo ("<input type=\"hidden\" name=\"x_amount\" value=\"$total\">\n");

?>
<input type="hidden" name="x_first_name" value="<?=firstName($_SESSION['user']['name'])?>">
<input type="hidden" name="x_last_name" value="<?=lastName($_SESSION['user']['name'])?>">
<input type="hidden" name="x_company" value="<?=$_SESSION['user']['company']?>">
<input type="hidden" name="x_address" value="<?=$_SESSION['user']['address']?>">
<input type="hidden" name="x_city" value="<?=$_SESSION['user']['city']?>">
<input type="hidden" name="x_state" value="<?=$_SESSION['user']['state']?>">
<input type="hidden" name="x_zip" value="<?=$_SESSION['user']['zip']?>">
<input type="hidden" name="x_phone" value="<?=$_SESSION['user']['phone']?>">
<input type="hidden" name="x_email" value="<?=$_SESSION['user']['email']?>">
<input type="hidden" name="x_cust_id" value="<?=$_SESSION['user']['username']?>">
<INPUT TYPE="HIDDEN" name="x_logo_url" VALUE= "https://secure.authorize.net/mgraphics/logo_99999.gif">
<INPUT type="hidden" name="x_show_form" value="PAYMENT_FORM">
<!--INPUT type="hidden" name="x_test_request" value="TRUE"-->

<!--input type="hidden" name="x_receipt_link_method" value="POST">
<input type="hidden" name="x_receipt_link_text" value="Click for listings">
<input type="hidden" name="x_receipt_link_url" value="http://website.com/confirmation.php"-->

<input type="hidden" name="x_relay_response" value="TRUE">
<input type="hidden" name="x_relay_url" value="http://website.com/confirmation.php">
<input type="hidden" name="<?=session_name()?>" value="<?=session_id()?>">

<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<? if ($total==0) { ?>
    <a href="account.php">Your Account</a>
<? } else { ?>
    <INPUT type="submit" value="Accept Order">
<? } ?>
</form> 
include("../../simdata.php");
#print_r($_POST);

// verify transaction comes from authorize.net and save user details
$responseCode = $_POST['x_response_code'];
if ( $responseCode == 1) { // approved
    $md5 = $_POST['x_MD5_Hash'];
    $transId = $_POST['x_trans_id'];
    $amount = $_POST['x_amount'];
    $myMD5 = strtoupper(md5("$x_tran_key$x_loginid$transId$amount"));
    #echo $myMD5;
    #print_r ($_POST);
    #print_r ($_SESSION['user']);

    if ($myMD5 == $md5) { // authenticated response from authorize.net
       ...
    } else {
        $error = "Unauthenticated response.";
    }
} else if (isset($_POST['x_response_code'])) { // error
    $error = $_POST['x_response_reason_text'].", #".$_POST['x_response_code'].'.'.$_POST['x_response_subcode'].
        '.'.$_POST['x_response_reason_code'];
}