Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 贝宝卷曲请求-错误代码0=81002_Php_Paypal - Fatal编程技术网

Php 贝宝卷曲请求-错误代码0=81002

Php 贝宝卷曲请求-错误代码0=81002,php,paypal,Php,Paypal,我试图通过cURL向Paypal服务器发送一个NVP支付请求,但最终总是得到ERRORCODE0=81002,这基本上意味着我的方法有问题。 但我似乎找不到问题所在: //The request parameters $request_params = array( 'METHOD' => 'PAY', 'VERSION' => '85.0', 'USER' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'PWD'

我试图通过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);

你从哪里得到这个样品的

我从未看到“方法”的“支付”价值 这些必须是有效的paypal操作。例如,最近我使用了DoDirectPayment(我认为这是paypal pro最常用的付款方式)

所有操作都可在其站点的下表中找到:


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

“支付”是一种自适应支付API方法,但这在上不可用——正如您所说,您需要使用适当的方法,如DoDirectPayment、SetExpressCheckout、GetBalance等。