【发布时间】: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