security - Paypal "Security header is not valid"错误。怎么办?

标签 security paypal payment-gateway

我正在使用 PayPal 的 DoDirectPayment API 进行支付集成。我收到如下错误消息。


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

这是我的代码,

    $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);

请帮我解决这个问题。

谢谢。

最佳答案

  1. 转到https://developer.paypal.com/developer/accounts

  2. 登录

  3. 创建企业帐户

  4. 点击企业账户,点击个人资料,点击 API 凭据并使用访问 API https://api-3t.sandbox.paypal.com/nvp

关于security - Paypal "Security header is not valid"错误。怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3905024/

相关文章:

sql - 让 SQL 管理在 Internet 上打开

Paypal 沙盒订阅 PAYER_CANNOT_PAY

asp-classic - Paypal DoDirectPayment : Live transaction failed

laravel-4 - 未知的付款方式 Nonce

C# asp.net 获取POST方法返回的数据

ruby-on-rails - 保护 REST 和 JSON

javascript - 如果存储在 SQL Server 中,哪些 HTML 标记会被视为危险?

javascript - 如何在 Outlook 加载项中存储凭据

php - Paypal setExpressCheckout nvp税额错误

php - 电子邮件链接中的 PayPal 自定义变量