我无法在php中测试这一行。
developer.paypal.com/webapps/developer/docs/classic/lifecycle/sb_calls /
curl -s --insecure https//api-3t.sandbox.paypal.com/nvp -d
"USER={YourUserID}
&PWD={YourPassword}
&SIGNATURE={YourSignature}
&METHOD=SetExpressCheckout
&VERSION=98
&PAYMENTREQUEST_0_AMT=10
&PAYMENTREQUEST_0_CURRENCYCODE=USD
&PAYMENTREQUEST_0_PAYMENTACTION=SALE
&cancelUrl=http//www.example.com/cancel.html
&returnUrl=http//www.example.com/success.html"
我正在使用:libcurl。 但我无法进行转换
感谢
答案 0 :(得分:0)
请注意:(a)您在(3)URL中缺少一些“:”字符,(b)您需要对参数键和值进行URL编码,(c)您不需要避免使用SSL针对指定的Paypal服务器的证书验证。但是你可以在PHP中使用它来实现类似的功能:
$url = 'https://api-3t.sandbox.paypal.com/nvp';
$data = array(
'USER' => '{YourUserID}',
'PWD' => '{YourPassword}',
'SIGNATURE' => '{YourSignature}',
'METHOD' => 'SetExpressCheckout',
'VERSION' => '98',
'PAYMENTREQUEST_0_AMT' => 10,
'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
'PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE',
'cancelUrl' => 'http://www.example.com/cancel.html',
'returnUrl' => 'http://www.example.com/success.html'
);
$post = http_build_query($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
echo $response;