【发布时间】:2017-01-18 00:47:41
【问题描述】:
我一直在尝试执行订阅计划。我遇到了账单协议形式的障碍。尝试创建协议时,我不断收到以下错误。
{"name":"VALIDATION_ERROR","details":[{"field":"plan","issue":"Invalid Fields passed in plan. Pass only a valid plan-id."}],"message":"Invalid request. See details.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR"}
我不确定问题出在哪里,试图强制协议的既定计划输出 id 本身也会导致 JSON 错误并且没有任何效果。 如果您需要更多信息,请随时询问。
$createdPlan = $startPlan->create($paypal);
$patch = new Patch();
$value = new PayPalModel('{
"state":"ACTIVE"
}');
$patch->setOp('replace')
->setPath('/')
->setValue($value);
$patchRequest = new PatchRequest();
$patchRequest->addPatch($patch);
$createdPlan->update($patchRequest, $paypal);
$plan = Plan::get($createdPlan->getId(), $paypal);
$agreement = new Agreement();
$agreement->setName($product . ' Agreement')
->setDescription('Recurring Payment')
->setStartDate(date(c, time()+4));
$agreement->setPlan($plan);
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$agreement->setPayer($payer);
$agreement->create($paypal);
【问题讨论】:
标签: php paypal paypal-rest-sdk paypal-subscriptions