使用PHP-curl:安全标头无效

时间:2015-08-11 13:29:28

标签: php curl paypal

我将其用于PayPal Express Checkout API,但我收到错误:

 public static void UpdateDebrief(int ID, string ItemNo, int QtyDelivered, int QtyNOTDelivered, string Reason)
    {
            JobDebrief deb = new JobDebrief
            {
                JobID = ID,
                ItemNo = "",
                QtyDelivered = 0,
                QtyNotDelivered = 0,
                DbriefReason = "",
                DbriefDate = DateTime.Now,
                DbriefedBy = CurrentUser.UserID
            };
            deb.Create();
    }

代码:

ACK=Failure&VERSION=78&BUILD=000000&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Security%20error&L_LONGMESSAGE0=Security%20header%20is%20not%20valid&L_SEVERITYCODE0=Error

我该怎么办?

2 个答案:

答案 0 :(得分:0)

安全标头无效通常是由于您的API凭据输入不正确。

curl_setopt($ch, CURLOPT_URL, "https://api-3t.sandbox.paypal.com/nvp");

看起来您正在发送到您的实时环境。确保使用正确的凭据。

当我使用你的字符串和curl调用我的凭据时,我得到一个积极的resposne:

Array
(
    [TOKEN] => EC-8JH22470WY0704826
    [TIMESTAMP] => 2015-08-11T17:24:08Z
    [CORRELATIONID] => 18a347794c5a1
    [ACK] => Success
    [VERSION] => 78
    [BUILD] => 000000
)

答案 1 :(得分:0)

好的,我找到了可以创建必要的Sandbox帐户的网站: https://developer.paypal.com/docs/classic/lifecycle/sb_create-accounts/