【问题标题】:paypal update billing plan amount is not working贝宝更新计费计划金额不起作用
【发布时间】:2018-06-18 02:49:09
【问题描述】:

我正在处理 paypal 更新计费计划金额,但它没有得到更新,我也浏览了一些 paypal 文档,但它仍然对我没有帮助,这是我的代码

代码

/************************** Update Billing Plan *****************/

            $jsonString = '[{
                "op": "replace",
                "path": "/payment_definitions/'.$payment_defination_id.'/amount",
                "value": {
                                    "value": "0",
                                    "currency": "USD"
                        }
            }]';

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_VERBOSE, true);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
            curl_setopt($ch, CURLOPT_URL,$paypal_update_plan_url.$paypal_plan_id.'/');
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'Authorization: Bearer '.$access_token));
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            $response = json_decode($response);
            echo "<pre>"; 
            print_r($response);
            die;

回应:

<pre>stdClass Object
(
    [name] => BUSINESS_VALIDATION_ERROR
    [details] => Array
        (
            [0] => stdClass Object
                (
                    [field] => validation_error
                    [issue] => Invalid Path provided.
                )

        )

    [message] => Validation Error.
    [information_link] => https://developer.paypal.com/docs/api/payments.billing-plans#errors
    [debug_id] => afb847748b312
)

谁能帮我解决这个问题?

【问题讨论】:

    标签: php paypal paypal-sandbox paypal-rest-sdk paypal-subscriptions


    【解决方案1】:

    我能够使用该 debug_id 查看我们的日志,它表明这在您的补丁中:

    "amount":
    {
      "value": "0",
      "currency": "USD"
    },
    

    您收到错误消息是因为我们不允许零美元计费计划。 “值”必须是正数才能有效。

    【讨论】:

      猜你喜欢
      • 2016-03-20
      • 2016-03-23
      • 2018-01-14
      • 2011-05-26
      • 2021-03-24
      • 2020-09-19
      • 2014-05-21
      • 2017-09-26
      • 2012-09-08
      相关资源
      最近更新 更多