문제

저는 PHP 프로젝트를 진행 중이며 좋은 Authorize.net 게이트웨이를 찾고 있습니다.나는 테스트된 성숙한 코드가 있는 것을 원합니다.목표는 Authorize.net API 문서를 기반으로 전체 내용을 직접 작성하고 테스트하는 것을 피하는 것입니다.

이에 대한 좋은 PHP 라이브러리를 아는 사람이 있나요?Google을 검색해도 아무 소용이 없습니다.

도움이 되었습니까?

해결책

authorize.net은 자체를 제공합니다 PHP 및 기타 언어 용 SDK. 다른 곳을 볼 필요가 없을 것입니다.

다른 팁

당신은 운이 좋다. 이것이 제가 사용하는 것 (SIM 게이트웨이의 경우)입니다.

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> 

그리고 이것이 내가 확인에 사용하는 것입니다 .php

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'];
}

양식 방법은이 정보를 전송하는 불안한 방법입니다. 더 나은 내기는 API AIM 방법을 사용하는 것입니다.

훌륭한 튜토리얼은 여기에서 찾을 수 있습니다.http://www.johnconde.net/blog/tutorial-integrating-authorizenet-aim-api-with-php

Magento는 Authorize.net을 지원합니다. Magento가 잘 테스트되고 양질의 코드로 필요한 코드를 추출하십시오.

SimData.php는 금액, 사람의 첫 이름 등과 같은 거래 데이터를 포함한다고 생각합니다.

James Gifford는 CodeIgniter를위한 일부 Authorize.net 코드를 만들었습니다. 여기서 다운로드 ...

http://jamesgifford.com/programming/codeigniter-authorize-net-library/

나는 php sdk를 사용하고 있습니다.

http://developer.authorize.net/downloads/

이것은 Codeigniter에서 사용하기에 적합한 라이브러리이지만 독립형으로 사용할 수 있습니다.

http://code.google.com/p/authorizenetlib/downloads/detail?name=authorize_net-1.pp

크레딧 : 코드의 James Gifford.

Kohana 2.3.x에 포함 된 지불 모듈을 내장 인증서 드라이버와 함께 사용했습니다. http://docs.kohanaphp.com/addons/payment

http://www.micahcarrick.com/04-19-2005/php-authorizenet-aim-interfacing-class.html

그것이 제가 사용하는 수업입니다.사용이 매우 간단합니다.하지만 전송하려는 변수와 전송하지 않는 변수를 파악하려면 여전히 API를 자세히 조사해야 합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top