2010-10-11 31 views
6

Tôi đang sử dụng API DoDirectPayment của PayPal để tích hợp thanh toán. Tôi nhận được một thông báo lỗi như dưới đây.Lỗi "Tiêu đề bảo mật không hợp lệ". Phải làm gì với điều này?


Security error: 
Error no: 10002 
Error message: Security header is not valid 

Đây là mã của tôi,

$environment = 'sandbox'; 
    // Set up your API credentials, PayPal end point, and API version. 
    $API_UserName = urlencode('xxxxxxxx'); 
    $API_Password = urlencode('xxxxxxxx'); 
    $API_Signature = urlencode('xxxxxxxxxxxxxxxxxxxxxxxxxxx'); 
    $API_Endpoint = "https://api-3t.paypal.com/nvp"; 
    if("sandbox" === $environment || "beta-sandbox" === $environment) { 
     $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp"; 
    } 
    $version = urlencode('51.0'); 

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

    // Set the curl parameters. 
    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); 

    // Set the API operation, version, and API signature in the request. 
    $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_"; 

    // Set the request as a POST FIELD for curl. 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); 

    // Get response from the server. 
    $httpResponse = curl_exec($ch); 

Xin hãy giúp tôi ra khỏi vấn đề này.

Cảm ơn.

Trả lời

0

Hãy chắc chắn để kiểm tra thiết bị đầu cuối API của bạn và phiên bản rất cẩn thận:

https://www.x.com/message/156280#156280

+5

vỡ liên kết 3/12/12 –

+0

liên kết đã bị xóa khỏi trang web –

+2

Hãy thử: https://developer.paypal.com/webapps/developer/docs/classic/api/endpoints/ –

0

Vấn đề của tôi xảy ra do thông tin api là không chính xác. Ngay cả sau khi nhập đúng tên người dùng, mật khẩu và khóa api sandbox, tôi vẫn gặp lỗi tương tự. Tôi đã tạo lại các tài khoản thử nghiệm của mình, nhập chúng vào ứng dụng của tôi một lần nữa, khởi động lại máy chủ và nó hoạt động.

Dưới đây là một liên kết từ x.com nói về một vấn đề tương tự: paypal security header issue

0

bạn nên thay đổi api.sandbox.paypal.com Endpoint của bạn, nó làm việc trên tôi Trước tiên, bạn đăng nhập vào sendbox hạch toán và kiểm tra trong tab ứng dụng

0

user2230647 là đúng. Bạn cần có thông tin sandbox cho tất cả các thông số sau trong trường hợp bạn muốn kiểm tra trong chế độ sandbox:

'api_endpoint' => 'https://api-3t.sandbox.paypal.com/nvp', 
'api_username' => 'example_api1.email.com', 
'api_password' => 'your_password', 
'api_signature' => 'your_signature', 
Các vấn đề liên quan