paypal:如何使用REST api访问协议的下一个开票日期

I need to access the next billing date for an agreement using the PayPal REST api via the php sdk.

I see inside

PayPal\Api\AgreementDetails;

We have

getNextBillingDate()

How do I access this?

I have:

...other code
use PayPal\Api\AgreementDetails;
$agreement_check = \PayPal\Api\Agreement::get($agreementID, $apiContext);
$renew_date = $agreement_check->getNextBillingDate();

I get the following error:

Fatal error: Call to undefined method PayPal\Api\Agreement::getNextBillingDate() 

What is the correct way to access this?

You're not using a method to return AgreementDetails in $agreement_check. The right method is named getAgreementDetails and it's part of Agreement Class, so you must do something like this:

use PayPal\Api\AgreementDetails;
$agreement_check = \PayPal\Api\Agreement::get($agreementID, $apiContext);
$agreement_details = $agreement_check->getAgreementDetails();
$renew_date = $agreement_details->getNextBillingDate();

Just take a good look at official PayPal PHP SDK documentation: Class PayPal Agreement - PHP PayPal SDK