2016-06-07 10 views
0

Iam neu paypal PHP SDK dies der Code iam ist mitPaypal PHP SDK 10002 Sicherheits Header Rückkehr ist nicht gültig

$RPProfileDetails = new RecurringPaymentsProfileDetailsType(); 
     $RPProfileDetails->SubscriberName = 'Test Customer'; 
     $RPProfileDetails->BillingStartDate = '29/5/2016'; 
     $activationDetails = new ActivationDetailsType(); 
     $activationDetails->InitialAmount = new BasicAmountType($currencyCode, 10); 

     $activationDetails->FailedInitialAmountAction = 'ContinueOnFailure';//$_REQUEST['failedInitialAmountAction']; 
     $paymentBillingPeriod = new BillingPeriodDetailsType(); 
     $paymentBillingPeriod->BillingFrequency = 365;//$_REQUEST['billingFrequency']; 
     $paymentBillingPeriod->BillingPeriod = 'Day';//$_REQUEST['billingPeriod']; 
     $paymentBillingPeriod->TotalBillingCycles = 365;//$_REQUEST['totalBillingCycles']; 
     $paymentBillingPeriod->Amount = new BasicAmountType($currencyCode, 10);//$_REQUEST['paymentAmount'] 
     $scheduleDetails = new ScheduleDetailsType(); 
     $scheduleDetails->Description = 'Artist Access amount';//$_REQUEST['profileDescription']; 
     $scheduleDetails->PaymentPeriod = $paymentBillingPeriod; 
     $createRPProfileRequestDetail = new CreateRecurringPaymentsProfileRequestDetailsType(); 
     $_REQUEST['token'] =''; 
     if(trim($_REQUEST['token']) != "") { 
      $createRPProfileRequestDetail->Token = $_REQUEST['token']; 
     } else { 
      $creditCard = new CreditCardDetailsType(); 
      $creditCard->CreditCardNumber = '41111111111111111';//$_REQUEST['creditCardNumber']; 
      $creditCard->CreditCardType = 'Visa';//$_REQUEST['creditCardType']; 
      $creditCard->CVV2 = '111';//$_REQUEST['cvv']; 
      $creditCard->ExpMonth = '9';//$_REQUEST['expMonth']; 
      $creditCard->ExpYear = '2022';//$_REQUEST['expYear']; 
      $createRPProfileRequestDetail->CreditCard = $creditCard; 
     } 
     $createRPProfileRequestDetail->ScheduleDetails = $scheduleDetails; 
     $createRPProfileRequestDetail->RecurringPaymentsProfileDetails = $RPProfileDetails; 
     $createRPProfileRequest = new CreateRecurringPaymentsProfileRequestType(); 
     $createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetail; 
     $createRPProfileReq = new CreateRecurringPaymentsProfileReq(); 
     $createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest; 
     $config = array(
       // values: 'sandbox' for testing 
       //   'live' for production 
       "mode" => "sandbox", 
       'log.LogEnabled' => true, 
       'log.FileName' => '../PayPal.log', 
       'log.LogLevel' => 'FINE', 

       // These values are defaulted in SDK. If you want to override default values, uncomment it and add your value. 
       // "http.ConnectionTimeOut" => "5000", 
       // "http.Retry" => "2", 
       // Signature Credential 
       "acct1.UserName" => "asp.mobileappz_api1.gmail.com", 
       "acct1.Password" => "TR2R87Q3W7XT7UJQ", 
       "acct1.Signature" => "AFcWxV21C7fd0v3bYYYRCpSSRl31Abq4txmPS2AOjtNVgh-ZRkhGwY3D", 
       // Subject is optional and is required only in case of third party authorization 
       // "acct1.Subject" => "", 

       // Sample Certificate Credential 
       // "acct1.UserName" => "certuser_biz_api1.paypal.com", 
       // "acct1.Password" => "D6JNKKULHN3G5B8A", 
       // Certificate path relative to config folder or absolute path in file system 
       // "acct1.CertPath" => "cert_key.pem", 
       // Subject is optional and is required only in case of third party authorization 
       // "acct1.Subject" => "", 
     ); 

     $paypalService = new PayPalAPIInterfaceServiceService($config); 
     try { 
      /* wrap API method calls on the service object with a try catch */ 
      $createRPProfileResponse = $paypalService->CreateRecurringPaymentsProfile($createRPProfileReq); 
     } catch (Exception $ex) { 
      echo '<pre>'; 
      PRINT_r($ex); 
      //include_once("../Error.php"); 
      exit; 
     } 
     if(isset($createRPProfileResponse)) { 
      echo "<table>"; 
      echo "<tr><td>Ack :</td><td><div id='Ack'>$createRPProfileResponse->Ack</div> </td></tr>"; 
      echo "<tr><td>ProfileID :</td><td><div id='ProfileID'>".$createRPProfileResponse->CreateRecurringPaymentsProfileResponseDetails->ProfileID ."</div> </td></tr>"; 
      echo "</table>"; 
      echo "<pre>"; 
      print_r($createRPProfileResponse); 
      echo "</pre>"; 
     } 
    } 
    Ack : 
Failure 
ProfileID : 
PayPal\PayPalAPI\CreateRecurringPaymentsProfileResponseType Object 
(
    [CreateRecurringPaymentsProfileResponseDetails] => PayPal\EBLBaseComponents\CreateRecurringPaymentsProfileResponseDetailsType Object 
     (
      [ProfileID] => 
      [ProfileStatus] => 
      [TransactionID] => 
      [DCCProcessorResponse] => 
      [DCCReturnCode] => 
     ) 

    [Timestamp] => 2016-06-07T03:29:31Z 
    [Ack] => Failure 
    [CorrelationID] => 9c2a8533bb7f5 
    [Errors] => Array 
     (
      [0] => PayPal\EBLBaseComponents\ErrorType Object 
       (
        [ShortMessage] => Security error 
        [LongMessage] => Security header is not valid 
        [ErrorCode] => 10002 
        [SeverityCode] => Error 
        [ErrorParameters] => 
       ) 

     ) 

    [Version] => 106.0 
    [Build] => 22204133 
) 

Ich habe überprüfen Sie die nicht wegen der falschen credentails gekreuzt i-Setup ein Sandbox-Konto auf Entwickler haben .paypal.com die URL ist, dass sdk create ist auch von sand box, aber zeigen, wie es nicht funktioniert bitte helfen. Ich habe absolut keine Ahnung. Auch dies ist ein Standardbeispiel von Paypal SDK selbst. Bitte schlage vor, wo ich falsch liege.

Antwort

0

10002 bezieht sich auf eine falsche API-Anmeldeinformationen, Sie Live-PayPal-Konto-Anmeldeinformationen und der Code verwenden, ist für Sandbox

 "mode" => "sandbox", 

ändern diese für die Umwelt zu leben und versuchen Sie es erneut ein.

+0

Ich habe es auf Sandbox gesetzt, weil ich in der Testphase bin. Ich weiß nicht, wo Sandbox-Anmeldedaten für dasselbe zu bekommen sind. Ich google und alle Links führen zur selben Seite. –

+0

Um Sandbox-Anmeldedaten zu erhalten, müssen Sie zu "developer.paypal.com" gehen und Testbenutzer erstellen. – CCamilo

+0

Wenn Sie es in Sandbox testen möchten, ersetzen Sie bitte die API-Anmeldeinformationen durch Sandbox-Kontoanmeldeinformationen. sandbox acc credentials können von developer.paypal.com -> Sandbox Accounts -> Sie können einen neuen Benutzer erstellen oder verwenden Sie einen existenten Benutzer – Fahim