我已在我的网站上添加了PayPal付款使用已保存的信用卡创建付款我已经对cURL和SDK进行了测试,请求在15-20秒内给我回复。这是正常的时间吗?
卷曲代码
$accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$credit_card = "CARD-xxxxxxxxxxxxxxxxxxxx";
$amt = 5;
$currency = "USD";
$description = "testing time";
$str = "{\n \"intent\": \"sale\",\n \"payer\": {\n \"payment_method\": \"credit_card\",\n \"funding_instruments\":[\n {\n \"credit_card_token\": {\n \"credit_card_id\": \"$credit_card\"\n }\n }\n ]\n },\n \"transactions\":[\n {\n \"amount\":{\n \"total\": \"$amt\",\n \"currency\": \"$currency\"\n },\n \"description\": \"$description\"\n }\n ]\n }";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Authorization: Bearer ".$accessToken;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
$result = curl_exec($ch);
curl_close ($ch);
echo $result;
SDK
sdk示例代码 - > http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingSavedCard.html