在贝宝计费计划API中获得空白响应

时间:2019-10-07 06:53:21

标签: php curl paypal payment-gateway billing

几天前,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
)

0 个答案:

没有答案