对不起我的英语。我脑子里有很多困惑。
我无法在 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。但我无法进行转换
谢谢
请注意,(a) (3) URL 中缺少一些":"字符,(b) 需要对参数键和值进行 URL 编码,以及 (c) 无需避免针对指定的PayPal服务器进行 SSL 证书验证。但是你可以把它用于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;