2016-06-27 6 views
0

TEMPLATE_ID_INVALIDの意味は?なぜ次のコードが失敗するのですか? 。PayPal SDK - 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/. 

答えて

0

私は解決策を見つけました。 $planidに間違った値がありました。正しい計画IDは、'P-86531922WW564673NESSWCCA'のようにする必要があります。

関連する問題