【问题标题】:Paypal Billing Agreement Invalid Plan Id PHPPaypal 账单协议无效的计划 ID PHP
【发布时间】: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


    【解决方案1】:

    我可以通过创建一个新的计划对象并仅将 id 设置为实际计划来解决此问题。

    $jsonplan = new Plan();
    $jsonplan->setId($createdPlan->getId());
    $agreement->setPlan($jsonplan);
    

    【讨论】:

      【解决方案2】:

      $createdPlan$agreement类中需要传入的计划变量

      $agreement->setPlan($createdPlan);
      

      【讨论】:

        猜你喜欢
        • 2020-10-05
        • 1970-01-01
        • 1970-01-01
        • 2015-06-20
        • 2014-12-15
        • 2018-05-07
        • 2017-10-23
        • 2012-05-04
        • 2017-06-21
        相关资源
        最近更新 更多