2010-12-21 14 views
1

こんにちは私は私のウェブサイトにペイパルを統合しています。そのユーザーが自分のサイトのすべての情報(クレジットカード情報と個人情報)を入力してほしいです。paypal速達チェックアウト問題

私はpaypal開発者のウェブサイトからpaypalfunctions.phpを流出させました。

私のコードは次のとおりです。 -

if(isset($_POST['submitCard'])) 
{ 
$firstName =trim($_POST['firstName']); 
$lastName =trim($_POST['lastName']); 
$street =trim($_POST['street']); 
$city =trim($_POST['city']); 
$state =trim($_POST['state']); 
$zip =trim($_POST['zip']); 
$countryCode =$_POST['country']; 
$currencyCode ='USD'; 
$paymentType ='Sale'; 
$paymentAmount =$_POST['productPrice']; 
$creditCardType =$_POST['cardType']; 
$creditCardNumber=$_POST['cardNo']; 
$expDate ='122015'; 
$cvv2 =$_POST['cvv']; 
$returnResult=DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber, 
     $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, 
     $countryCode, $currencyCode); 
echo '<pre>'; 
    print_r($returnResult); 

DirectPayment方法がpaypalFunctions.phpであり、これは

function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber, 
     $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, 
     $countryCode, $currencyCode) 
{ 
    //Construct the parameter string that describes DoDirectPayment 
    $nvpstr = "&AMT=" . $paymentAmount; 
    $nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCode; 
    $nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType; 
    $nvpstr = $nvpstr . "&CREDITCARDTYPE=" . $creditCardType; 
    $nvpstr = $nvpstr . "&ACCT=" . $creditCardNumber; 
    $nvpstr = $nvpstr . "&EXPDATE=" . $expDate; 
    $nvpstr = $nvpstr . "&CVV2=" . $cvv2; 
    $nvpstr = $nvpstr . "&FIRSTNAME=" . $firstName; 
    $nvpstr = $nvpstr . "&LASTNAME=" . $lastName; 
    $nvpstr = $nvpstr . "&STREET=" . $street; 
    $nvpstr = $nvpstr . "&CITY=" . $city; 
    $nvpstr = $nvpstr . "&STATE=" . $state; 
    $nvpstr = $nvpstr . "&COUNTRYCODE=" . $countryCode; 
    $nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR']; 

    $resArray=hash_call("DoDirectPayment", $nvpstr); 

    return $resArray; 
} 


/** 
    '------------------------------------------------------------------------------------------------------------------------------------------- 
    * hash_call: Function to perform the API call to PayPal using API signature 
    * @methodName is name of API method. 
    * @nvpStr is nvp string. 
    * returns an associtive array containing the response from the server. 
    '------------------------------------------------------------------------------------------------------------------------------------------- 
*/ 
function hash_call($methodName,$nvpStr) 
{ 
    //declaring of global variables 
    global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature; 
    global $USE_PROXY, $PROXY_HOST, $PROXY_PORT; 
    global $gv_ApiErrorURL; 
    global $sBNCode; 

    //setting the curl parameters. 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,$API_Endpoint); 
    curl_setopt($ch, CURLOPT_VERBOSE, 1); 

    //turning off the server and peer verification(TrustManager Concept). 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 

    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
    curl_setopt($ch, CURLOPT_POST, 1); 

    //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. 
    //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
    if($USE_PROXY) 
    curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); 

    //NVPRequest for submitting to server 
    $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode); 

    //setting the nvpreq as POST FIELD to curl 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); 

    //getting response from server 
    $response = curl_exec($ch); 

    //convrting NVPResponse to an Associative Array 
    $nvpResArray=deformatNVP($response); 
    $nvpReqArray=deformatNVP($nvpreq); 
    $_SESSION['nvpReqArray']=$nvpReqArray; 

    if (curl_errno($ch)) 
    { 
    // moving to display page to display curl errors 
    $_SESSION['curl_error_no']=curl_errno($ch) ; 
    $_SESSION['curl_error_msg']=curl_error($ch); 

    //Execute the Error handling module to display errors. 
    } 
    else 
    { 
    //closing the curl 
    curl_close($ch); 
    } 

    return $nvpResArray; 
} 


    } 
    ?> 

である、それは私は問題がされているかを理解カントエラーに

  Array 
(
    [TIMESTAMP] => 2010-12-21T06:06:54Z 
    [CORRELATIONID] => 1cafc53222e76 
    [ACK] => Failure 
    [VERSION] => 64 
    [BUILD] => 1620725 
    [L_ERRORCODE0] => 10002 
    [L_SHORTMESSAGE0] => Security error 
    [L_LONGMESSAGE0] => Security header is not valid 
    [L_SEVERITYCODE0] => Error 
) 

を与えますお助けください。

+0

あなたのサイトでクレジットカード情報を受け入れるには、PCIに準拠している必要があります。http://selfservice.talisma.com/display/2n/index.aspx?c = 58&cpc = MSdA03B2IfY15uvLEKtr40R5a5pV2lnCUb4i1Qj2q2g&cid = 81&cat =&catURL =&r = 0.420776844024658? – Zabba

答えて

0

API資格情報を正しく設定しましたか? 必要に応じてhash_callをダンプできます。

あなたはサンドボックス・テストを行っている場合は、 は、コールのエンドポイントであることを確認してください:https://api-3t.sandbox.paypal.com/nvp は - を指摘し、「サンドボックス」

+0

また、グローバル$ API_Endpoint、$ version、$ API_UserName、$ API_Password、$ API_Signatureを設定する必要があります。 – rick

1

ここでも心配する必要があるいくつかのことがあります:

開発者向けサイトへ
  1. ログイン: https://developer.paypal.com/

  2. をアプリケーション

    に行きます は、左側には、「サンドボックスアカウント」

1が存在しない場合は、「アカウントを作成」ボタンで右そこ型事業の一つを作成することができるはずがヒット。

  1. アカウントをクリックし、[プロフィール]を選択し、アカウントがビジネスの種類であることを確認します。
  2. [API認証情報]タブには、使用するユーザー名/パスワード/署名が表示されます。

sandbox URLを使用するときにサンドボックスアカウントの資格情報を使用しないと、この10002セキュリティエラーが有効なコードではなくなる可能性があります。