【问题标题】:Paypal cURL request - ERRORCODE0=81002贝宝 cURL 请求 - ERRORCODE0=81002
【发布时间】:2012-04-02 13:25:17
【问题描述】:

我正在尝试通过 cURL 向 Paypal 服务器发出 NVP 支付请求,但我总是得到 ERRORCODE0=81002,这基本上意味着我的方法有问题。 但我似乎无法找到问题:

//The request parameters
 $request_params = array(
    'METHOD' => 'PAY',
    'VERSION' => '85.0',
    'USER' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'PWD' => 'xxxxxxxxxxxxxxxx',
    'SIGNATURE' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'CURRENCYCODE' => 'USD',
    'RETURNURL' => 'https://localhost',
    'CANCELURL' => 'https://localhost'
 );
 $endpoint = 'https://api-3t.sandbox.paypal.com/nvp?';

 //Building the NVP string
 $request = http_build_query($request_params);

 //cURL settings
 $curl_options = array(
    CURLOPT_URL => $endpoint,
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $request,
    CURLOPT_VERBOSE => 1,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_TIMEOUT => 30,
 );

 $ch = curl_init();
 curl_setopt_array($ch, $curl_options);

 $response = curl_exec($ch);

 curl_close($ch);

【问题讨论】:

    标签: php paypal


    【解决方案1】:

    你从哪里得到这个样本?

    我从未见过“METHOD”的值“PAY” 这些必须是有效的贝宝操作。例如,最近我使用了 DoDirectPayment(我认为这是使用 paypal pro 付款最常用的方法)

    所有操作都可以在他们网站上的这个表中找到:http://rvyu.com/rcuu

    更新:所以主要问题是:你想做什么?因为我认为您没有付款,因为您没有发送一些基本字段(例如金额或卡号);然后寻找与您需要采取的行动相匹配的值

    【讨论】:

    • 'Pay' 是一种自适应支付 API 方法,但这在 api-3t.sandbox.paypal.com/nvp 上不可用——正如您所说,您需要使用适当的方法,例如 DoDirectPayment、SetExpressCheckout、GetBalance ,等等。
    猜你喜欢
    • 1970-01-01
    • 2012-04-15
    • 2014-06-21
    • 2011-12-26
    • 2019-06-25
    • 1970-01-01
    • 1970-01-01
    • 2011-08-25
    • 2017-11-27
    相关资源
    最近更新 更多