【问题标题】:PayPal SDK - TEMPLATE_ID_INVALIDPayPal SDK - TEMPLATE_ID_INVALID
【发布时间】:2016-10-30 01:38:52
【问题描述】:

TEMPLATE_ID_INVALID 是什么意思?为什么下面的代码会失败? .

$apiContext=getApiContext();
$agreement = new Agreement();
$agreement->setName("name")
->setDescription("descr")
->setStartDate( date("Y-m-d\TH:i:s",strtotime("+1 days"))."Z"  );
$plan = new Plan();
$plan->setId($planid);
$agreement->setPlan($plan);

$payer = new Payer();
$payer->setPaymentMethod('paypal');
$agreement->setPayer($payer);

try {
 $agreement = $agreement->create($apiContext);
 $approvalUrl = $agreement->getApprovalLink();
} catch (Exception $ex) {

}

异常$ex 是:

  PayPal\Exception\PayPalConnectionException object {
  url => (string) https://api.sandbox.paypal.com/v1/payments/billing-agreements/
  data => (string) {"name":"TEMPLATE_ID_INVALID","details":[{"field":"template id is invalid","issue":"Incorrect Template Id."}],"message":"","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#TEMPLATE_ID_INVALID","debug_id":"fdf8520bc9574"}
  message => (string) Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/billing-agreements/.

【问题讨论】:

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


    【解决方案1】:

    我找到了解决方案。 $planid 的值错误。正确的计划 ID 必须类似于:'P-86531922WW564673NESSWCCA'

    【讨论】:

      猜你喜欢
      • 2021-09-17
      • 2014-11-23
      • 2014-02-14
      • 2012-09-14
      • 2018-02-08
      • 2014-07-16
      • 2013-12-15
      • 2021-10-03
      • 2019-03-26
      相关资源
      最近更新 更多