我正在尝试通过 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 最常用的付款方式)
所有操作都在其网站上的此表中可用:http://rvyu.com/rcuu
更新:所以主要问题是:你想做什么?因为我认为您没有付款,因为您没有发送一些基本字段(例如金额或卡号);之后寻找与您需要采取的操作相匹配的值
关于php - Paypal cURL 请求 - ERRORCODE0=81002,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9977330/