Несколько дней назад внезапно paypal
онлайн-биллинг API
дает пустой ответ. Тот же код отлично работает в sandbox API
. Также попробуйте с новой paypal
учетной записью, но все еще не работает. Попробуйте создать новое приложение с новым client id
и секретным ключом, который все еще получает пустой ответ. Вот мой код скручивания .
// ================================ create Plan request=================
$dataPlan = '{
"product_id": "' . $Product_id . '",
"name": "Daily Subscription Plan",
"description": "Daily Subscription Plan",
"billing_cycles": [
{
"frequency": {
"interval_unit": "DAY",
"interval_count": "1"
},
"tenure_type": "REGULAR",
"sequence": 1,
"total_cycles": 1,
"pricing_scheme": {
"fixed_price": {
"value": ' . $TotalAmount . ',
"currency_code": "USD"
}
}
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"value": "0",
"currency_code": "USD"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
"taxes": {
"percentage": "0",
"inclusive": false
}
}';
$chPlan = curl_init();
if (IS_LIVE_PAYPAL == true) {
curl_setopt($chPlan, CURLOPT_URL, "https://api.paypal.com/v1/billing/plans");
}
curl_setopt($chPlan, CURLOPT_POST, true);
curl_setopt($chPlan, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chPlan, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($chPlan, CURLOPT_POSTFIELDS, ($dataPlan));
curl_setopt($chPlan, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json',
'Prefer: return=representation',
'Authorization: Bearer ' . $ACCESS_TOKEN));
$resultPlan = curl_exec($chPlan);
if (empty($resultPlan)) die("Error: No response. 3");
curl_close($chPlan);
Вот результат $info = curl_getinfo($chPlan);
Array
(
[url] => https://api.paypal.com/v1/billing/plans
[content_type] =>
[http_code] => 404
[header_size] => 265
[request_size] => 1100
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.189075
[namelookup_time] => 3.5E-5
[connect_time] => 0.032397
[pretransfer_time] => 0.111496
[size_upload] => 812
[size_download] => 0
[speed_download] => 0
[speed_upload] => 4296
[download_content_length] => 0
[upload_content_length] => 812
[starttransfer_time] => 0.189049
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 173.0.88.66
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 134.209.162.208
[local_port] => 60466
)